开发者

Passing String parameter into Javascript

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开发者_如何学Go(<%=testing%>)"
> Click </a>

How can I resolve it?


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 ''

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜