i am trying to do something simple but it is not working. i am trying to call a javascript function from a hyperlink and pass the function a string variable. the string variable i am sending to the function has been dynamically generated by asp.net code from a database, but ive looked at the HTML code being outputted at it is like this:
<a href='javascript:func_Link('SMI1133')'>SMI1133</a>
my function is then supposed to do 2 things:
1. redirect the page to a URL depending upon the selected item in myDropDownList.
2. append the input variable onto the end as a query string:
script language="javascript">
function func_Link(code)
{
document.form1.action=document.form1.myDropDownList.value + ".aspx?code=" + code;
document.form1.submit();
}
</script>
can anyone tell me why this is not working? i am getting a syntax error message. if i remove the input variable so that the HTML being outputted it works but then i dont have a variable to append to my query string!:
<a href='javascript:func_Link()'>SMI1133</a>
thanks for any help
<a href='javascript:func_Link('SMI1133')'>SMI1133</a>
my function is then supposed to do 2 things:
1. redirect the page to a URL depending upon the selected item in myDropDownList.
2. append the input variable onto the end as a query string:
script language="javascript">
function func_Link(code)
{
document.form1.action=document.form1.myDropDownList.value + ".aspx?code=" + code;
document.form1.submit();
}
</script>
can anyone tell me why this is not working? i am getting a syntax error message. if i remove the input variable so that the HTML being outputted it works but then i dont have a variable to append to my query string!:
<a href='javascript:func_Link()'>SMI1133</a>
thanks for any help
Comment