Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   passing string to javascript function from asp (http://www.go4expert.com/forums/passing-string-javascript-function-asp-t8674/)

rag84dec 6Feb2008 09:27

passing string to javascript function from asp
 
Hi,
i tried the following to use a string from asp code in javascript but it didnt work....please tell me how to pass a string to a javascript


Code: ASP

<script language="JavaScript">
 function ChangeAll(f)
 {
     
     alert(f);
 }
 
 </script>
 
 <%
 
 
 
 r="here"
 response.write("<form method='post'>")
 response.write("<input type='button' value='Submit' onClick='ChangeAll(''"&r&"'')'    ")
 response.write("</form>")
 
 %>


pradeep 6Feb2008 09:57

Re: passing string to javascript function from asp
 
Probably the code should look like this,

Code: ASP

<script language="JavaScript">
function ChangeAll(f)
{
    alert(f);
}

</script>

<%



r="here"
response.write("<form method='post'>")
response.write("<input type='button' value='Submit' onClick='ChangeAll("""&r&""")' ")
response.write("</form>")

%>



All times are GMT +5.5. The time now is 00:09.