i have to pass a string value which is stored in a variable to a javascript function
which i'm calling in a button click event of my asp.net c# web application.
i have tried some ways but not getting exactly.
below is the code which i'm using
protected void Button1_Click(object sender, EventArgs e)
{
myButton.Attributes.Add("onclick", "openNewWindow(spcd)");
}
this is my button click event function
'opennewwindow' is my javascript function and 'spcd' is my variable which is a string variable, which is a public string variable.
below is my javascript function
<script type="text/javascript">
function openNewWindow(spcd) {
//alert("hello");
var tt = spcd;
alert(tt);
var theurl="http://www.gmail.com";
popupWin = window.open(theurl,
'_blank',
'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0')
}
</script>
but when i do like this my javascript in not working.
can any one tell which is the actual way to do this