I have a server variable (VBScript) called selectedOptions. I need to assign it a value based on the value of a select box. Currently I am trying to use Javascript to handle the onchange event of the select box and then pass the selected value to the selectedOptions variable.
function select_touchGloves_onchange()
{
var mySelect = document.getElementById("select_touchGloves");
<% selectedOptions %> = mySelect.options[mySelect.selectedIndex].value;
}
This code is is giving me a type mismatch error. Can I correct this? Or is there a way I can obtain this value solely with vbscript?
EDIT---------------------------------------------------------------------------------------
This question is no longer what I need - please see the comments below for further information if you are interested.
<% %>tags, will execute on the server when the page is first requested, the results are sent to the browser, and then the client-side JavaScript executes. So you can't assign a value to your VB variables from JavaScript. You can use JavaScript to make another request to your server (preferably but not necessarily with Ajax) to pass the selected item through. What do you want to do with the value?