...

View Full Version : deactivating button



verginette
08-01-2006, 04:49 PM
help everyone...

have a problem with deactivating buttons. i wanted to create a js that would activate a second button if the first button is clicked.

the sample below would activate the button if the correct text input is given (though written in vbscript.. guess they are almost the same)


<INPUT name="edit1" size="50">
<SCRIPT type="text/vbscript">
Sub edit1_changed()
If edit1.value = "abc" Then
button1.enabled = True
Else
button1.enabled = False
End If
End Sub
</SCRIPT>

can anyone pls help me make a script in js replacing the text input to button so the second button would be activated...

your help would be greatly appreciated... thank you.

vwphillips
08-01-2006, 05:18 PM
this is a JavaScript forum


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
</head>

<body>

<INPUT name="edit1" size="50" onblur="edit1_changed(this,'button1','abc');" >
<input type="button" id="button1" value="Test" onclick="alert('enabled');" />
<SCRIPT type="text/javascript">

function edit1_changed(obj,id,val){
var zxcobj=document.getElementById(id);
zxcobj.removeAttribute('disabled');
if (obj.value==val){
zxcobj.setAttribute('disabled','disabled');
}
}
</SCRIPT>

</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum