Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent about javascript ,Thanks

 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If there's a webpage have 1)a Textbox 2)A form button
If I want : if the textbox havent inputted anything, the form button is disable, how can I do this? Thanks.
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, it must work in Netscape, I know a method to work in IE but not in Netscape, as follows:
<script language="javascript">
function test() {
if (document.form1.textbox.value!="")
document.form1.button.disabled = false;
else
document.form1.button.disabled = true;
}
</script>
<form name="form1">
<input type="text" value="" name="textbox" onKeyup="test()">
<input type="button" name="button" value="Button" disabled>
</form>
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want 'disabled' or 'doesn't work'?
'Disabled' I'm not so sure on, I'll have a look for the compatibility (it might not be supported in NS...
'Doesn't work' you can always achieve with client side validation.
Dave
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.faqts.com/knowledge_base/view.phtml/aid/1747/fid/309
Hope this will help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic