Click to See Complete Forum and Search --> : How to pass a binddata variable from html to javascrip


hossein
12-29-2005, 02:53 PM
Hi,
I am using asp.net with a variable named emailstr, used the variable like onmouseover="singy(<%#emailstr%> )" in html which singy is a function in Javascript <script language="javascript">
<!--
function singy(c)
{
document.write(c);
}
The problem is: it does not do anything, anybody can help, please; thanks.
Hossein

JoeyD
12-31-2005, 08:06 AM
Try Response.write(emailstr). I think that will work

hossein
01-01-2006, 12:36 PM
Thanks, JoeyD
but I want to use the variable (emailstr) in Javascript function
Happy new year

JoeyD
01-03-2006, 06:48 AM
I don't have my code in front of me but I think this is how I would write the html for it.

onmouseover="<%# Response.write("singy(" & emailstr & ")") %>"

hossein
01-03-2006, 12:03 PM
the error message the server tags cannot contain <%...%> constructs shows up

hossein
01-03-2006, 12:08 PM
sorry, the server tag is not well formated shows up