Online Schooling - Find jobs - Debt Consolidation - Find jobs - Gavin Newsom

PDA

View Full Version : Disabling and enabling the form text fields


ZeroOne
Jun 16th 2005, 3:59 pm
Can I make the form text fields disable and when click on text fields it change

to enable.

I try to do that but it not work :

<SCRIPT LANGUAGE="JavaScript">
function enable() {
document.formname.textname.disabled=false;
}
</SCRIPT>

<form name="formname" method="POST" action="">
<input type="text" disabled size="10" name="textname" onclick="enable()">
....
.


my another question is if the name of the input text is array like :
<input type="text" size="10" name="textname[]" >
how i can deal with it in javascript code (document.formname.(here))

Thanks :)

J.D.
Jun 16th 2005, 7:48 pm
Can I make the form text fields disable and when click on text fields it change

to enable.<form>
<input id="i1" type="text" size="10" name="textname" onclick="this.disabled = true">
<input type="button" name="textname" value="toggle" onclick="this.form.i1.disabled = !this.form.i1.disabled">
</form>


J.D.