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
 
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>
 
J

Jon Spivey

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Function... 15
Dropdown events... 2
DRW Submit Button... 5
Script Question... 4
Script... 6
Checkbox Question... 2
checkbox doesn´t work 5
Help needed with Javascript function 1

Top