textbox Disable on value....


1

116

I am attempting to disable a textbox based on its value at load. There are
actually 3 in question. Only dealing with the one at this time.

<script type="text/javascript">
function disaban()
{
with (document.forms[0])
{
var an = AUDITNO.value

if (an = "-")
{
document.forms[0].AUDITNO.disabled=true;
}
}
}
</script>

David
 
Ad

Advertisements

T

Trevor Lawrence

David,

I could look into this, but I am wondering

If you want the textarea disabled on load, why not just set it in the HTML?
E.G. http://www.w3schools.com/tags/att_textarea_disabled.asp
<textarea rows="3" cols="25" disabled="disabled">
At W3Schools you will find all the Web-building tutorials you need, from
basic HTML to advanced XML, SQL, ASP, and PHP.
</textarea>
 
Ad

Advertisements

J

Jon Spivey

This
if (an = "-")
should be
if (an == "-")
eg
if(document.forms[0].AUDITNO.value=='-')document.forms[0].AUDITNO.disabled=true;
 

Similar threads

1
Replies
15
Views
715
Jon Spivey
J
1
Replies
4
Views
345
Jon Spivey
J
1
Replies
6
Views
516
Trevor Lawrence
T
1
Replies
5
Views
1K
Stefan B Rusynko
S
1
Replies
2
Views
343
116
1
1
Replies
2
Views
994
116
1
L
Replies
5
Views
138
David Berry
D
J
Replies
1
Views
172
Kevin Spencer
K
Top