Search code examples
javascriptvbscriptasp-classicdom-events

Type mismatch when assigning a value from javascript to a vbscript variable


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.


Solution

  • Your question has problems.

    It's confusing concepts ASP server concepts and client concepts.

    I recommend that you build at least two pages. One a plain HTML form with a submit button and another the ASP page that processes the form. You ought to follow an ASP tutorial, such as this one: http://www.asptutorial.info/learn/Forms.html.

    If you provide more information about the problem your trying to solve, we can tailor an answer that's more suitable for you.