最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Passing String parameter into Javascript - Stack Overflow

programmeradmin0浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论