Sign in to follow this  

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

This topic is 4841 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
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

This topic is 4841 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this