I have a coldfsuion varible that is need to sent to the javascript function , I am not sure how to do this: <cfset Id = getRpcmtHistory.LeadId> /Id is the variable that has numeric value <a href="javascript : poponload();"> /what should I put in () when I put Id it gave me an error that Id is not identify. Also what should I put in JavaScript function at the top: function poponload(?) { }
I'm not too familiar with ColdFusion but this is how we usually pass a variable to a function in javascript: <html> <body> <script type="text/javascript"> function watever (the_variable) { alert(the_variable); } </script> <a href="#" onclick="watever('YES');">Link</a> </body> </html> HTML: Also, keep in mind on what you're passing because '5' and 5 are not the same.
Thanks for the reply, in this case YES has been pass to the function as a fix string, I want to pass variable for example consider Var Id; Id sometime is 1, or 2, or 3, and so on so I need to send variable Id not the actual 1,2, 3.
<cfset Id = getRpcmtHistory.LeadId[i]> <script type="text/javascript" language="JavaScript"> <cfoutput> var #toScript(Id, "ident")#; </cfoutput> </script> Code (markup): This should create a JavaScript variable called ident holding the value of Id ( ColdFusion ). ** I'm not by any means a ColdFusion expert but it *should* work as expected.