Problem With The ReadOnly Property

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > JavaScript

Problem With The ReadOnly Property

TavoxPeru
I have a problem setting the readonly property of a textbox which depends on a yes and no radio buttons selection, I'm sure that my code is correct but i dont know why nothing happens.
This is code:
CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script LANGUAGE="JavaScript">
<!-- Begin
function changeRadio(sVal) {
    if (sVal=='n')
    {
        a.textval.readonly=true;
        a.texval.value="";
    }
    else {
        a.textval.readonly=false;
    }
}
//  End -->
</script>
</HEAD>

<BODY>
<form name="a" method="post">
<table class="tabla" width="100%" border="0" cellpadding="2" cellspacing="10">
   <tr>
   <td width="32%">READONLY TEXTBOX</td>
   <td>
   <input type="radio" value="n" name="radiobtn" onclick="changeRadio('n')" CHECKED>No<BR /><input type="radio" value="s" name="radiobtn" onclick="changeRadio('s')">Yes</td>
   </tr>
   <tr>
   <td class='textoedicion' width="32%">TEXTBOX</td>
   <td><input type="text" name="textval" value='' size="21" maxlength="20"></TD>
    </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" valign="middle"><input type="submit" name="submit" value="Save"> <input type="button" name="cancel" value="Cancel" onClick="window.close()"></td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
<!--
if (document.a.radiobtn[0].checked) {
    document.a.textval.readonly=true;
}
else {
    document.a.textval.readonly=false;
}
//-->
</script>
</BODY>
</HTML>

Best regards,

 

 

 


Reply

seec77
Took me a couple of minutes and a little search over here to understand your problem. Javascript is a case conscious language, and so you have to write "readOnly" instead of "readonly". A very simple find and replace should solve your problem! biggrin.gif

Reply

TavoxPeru
QUOTE(seec77 @ Aug 30 2006, 06:12 AM) *

Took me a couple of minutes and a little search over here to understand your problem. Javascript is a case conscious language, and so you have to write "readOnly" instead of "readonly". A very simple find and replace should solve your problem! biggrin.gif

Thanks a lot, i just search and replace and run it, and everything works fine.

best regards,

Reply

iGuest
Why does the Alert dialog box state -4bf has no properties when starting FireFox 2
Problem With The ReadOnly Property

The last 2-3 days I have been unable to access my FireFox 2 program.
The first page of the Firefox 2 program appears and then a popup box appears stating:

Alert.
TypeError: -4bf has no properties
I have downloaded a fresh copy of Firefox 2, with the same result
Please, can you help me?

elwaltura

-question by Walter Earnshaw

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. input properties readonly=false - 31.01 hr back. (3)
  2. javascript readonly property - 46.66 hr back. (1)
  3. js how to set readonly property radio - 48.23 hr back. (1)
  4. change readonly property of input box by javascript - 54.54 hr back. (1)
  5. javascript element readonly not working - 62.49 hr back. (1)
  6. read only document problem - 73.63 hr back. (1)
  7. javascript readonly state - 82.26 hr back. (1)
  8. readonly false not working firefox - 88.41 hr back. (1)
  9. javascript detect readonly - 89.89 hr back. (1)
  10. html radio button readonly javascript - 94.37 hr back. (1)
  11. php read-only property of class - 96.24 hr back. (1)
  12. html input readonly javascript - 97.62 hr back. (1)
  13. php class read only property - 100.06 hr back. (1)
  14. how to use readonly property in javascript - 101.86 hr back. (1)
Similar Topics

Keywords : readonly


    Looking for problem, readonly, property






*SIMILAR VIDEOS*
Searching Video's for problem, readonly, property
advertisement




Problem With The ReadOnly Property



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE