HELP ME!! JavaScript!!

willemvo

New Member
Messages
19
Reaction score
0
Points
0
Can anybody tell me what i did wrong?? 'cause i have no idea:dunno:!!;;
Code:
<html>
<head>
<SCRIPT language="JavaScript1.3" type="text/JavaScript">
function disable()
{
    var code = form.code.value;
    if (form.code.value == 'g')
    {
        document.getElementById("mySelect").disabled=false
    } else
    {
        document.getElementById("mySelect").disabled=true
    }
}
</SCRIPT>
<body>
<form>
<input type="text" name="code" value="code">
<input type="button" name="butt1" onClick="disable()" value="Controleer">
<input type="button" name="butt2" value="verzend" id="mySelect" disabled>
</form>
</body>
</html>
;;
thanks!
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
You need to have "form" defined. Try this:

HTML:
<html>
<head>
<SCRIPT language="JavaScript1.3" type="text/JavaScript">
function disable(form)
{
    var code = form.code.value;
    if (form.code.value == 'g')
    {
        document.getElementById("mySelect").disabled=false
    } else
    {
        document.getElementById("mySelect").disabled=true
    }
}
</SCRIPT>
<body>
<form>
<input type="text" name="code" value="code">
<input type="button" name="butt1" onClick="disable(this.form)" value="Controleer">
<input type="button" name="butt2" value="verzend" id="mySelect" disabled>
</form>
</body>
</html>
 
Top