admin管理员组

文章数量:1389903

I am passing String parameter into javascript . But it is not being called. this is my script:

function downloadPopup(testing){      
alert(testing); }

I am calling the javascript like this from my jsp page:

<% String testing = "DSfsdsfd" ; %> <a
href="javascript:downloadPopup(<%=testing%>)"
> Click </a>

How can I resolve it?

I am passing String parameter into javascript . But it is not being called. this is my script:

function downloadPopup(testing){      
alert(testing); }

I am calling the javascript like this from my jsp page:

<% String testing = "DSfsdsfd" ; %> <a
href="javascript:downloadPopup(<%=testing%>)"
> Click </a>

How can I resolve it?

Share Improve this question edited May 9, 2012 at 12:03 Daniel Fischer 184k18 gold badges317 silver badges435 bronze badges asked Jan 23, 2010 at 22:08 Gnaniyar ZubairGnaniyar Zubair 8,17623 gold badges64 silver badges72 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

I think you are missing quotes around your string:

<% String testing = "DSfsdsfd" ; %> <a
href="javascript:downloadPopup('<%=testing%>')"
> Click </a>
downloadPopup('<%=testing%>')

dont forget to put string in ''

本文标签: Passing String parameter into JavascriptStack Overflow