Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

HTML & Javascript: I cant disable textfield from onclick of radio button, whats wrong

This topic is 5054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi im using html. I've got a textfield and a radio button. When the radio button is clicked i want the textfield to be disabled. But nothing happens when i try.
<html>
<head><script language="JavaScript1.4"></script></head>

<body>
<form name="form1" method="post" action="">
<input name="username" type="text" id="username" size="20" maxlength="15">
<input type="radio" name="access" value="theatreManager" onClick="javascript:document.form1.username.disable = true;">
</form>
</body>
</html>



Any idea whats wrong? thanks

Share this post


Link to post
Share on other sites
Advertisement
perhaps you could try:


<head>
function disableTextBox(){
username.value = "";
username.readonly = true;
}
</head>

<input name="username" type="text" id="username" size="20" maxlength="15">
<input type="radio" name="access" value="theatreManager" onClick="disableTextBox()">



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!