Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Change readonly property in javascript

Results 1 to 4 of 4
Share This Thread →
  1. #1
    Belord is offline Contributing User
    Join Date
    Dec 2004
    Posts
    329
    Rep Power
    10

    Change readonly property in javascript

    Hi,

    i have one textbox which is disabled when the form is
    displayed for first time when the user clicks on the radio button "no" i want the readonly property of the textbox to be false

    my code is as follows

    <input type="text" name="SFName" id="SFName" value="" readonly /></p>

    <input type="radio" name="billship" value="No" onclick="callme()" >No

    function callme()
    {
    if(document.frm1.billship.checked)
    {


    document.frm1.SFName.readonly = false;
    }

    }


    this code is not working i tried doing it in this way also
    <input type="text" name="SFName" id="SFName" value="" readonly="true" />

    but this doesnt work also can anyone tell me how it can be done

    your help is highly appreciated

    thanks,

    belord
    Faq

  2. #2
    Shadow Wizard's Avatar
    Shadow Wizard is offline Moderator From Beyond
    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,126
    Rep Power
    2921
    you were very close:
    document.frm1.SFName.readOnly = false;
    will do the trick. case sensitive, always remember......
    Faq

  3. #3
    Blizzy is offline Registered User
    Join Date
    Nov 2007
    Posts
    1
    Rep Power
    0
    Quote Originally Posted by Belord
    <input type="text" name="SFName" id="SFName" value="" readonly /></p>

    <input type="radio" name="billship" value="No" onclick="callme()" >No

    function callme()
    {
    if(document.frm1.billship.checked)
    {
    document.frm1.SFName.readonly = false;
    }

    }

    this code is not working i tried doing it in this way also
    <input type="text" name="SFName" id="SFName" value="" readonly="true" />
    Almost four years from your post... I hope you have solved that already, nevertheless I'll post the solution at least for others.

    Actually, this was my motivation for signing up on this forum. I just ran into the same situation, however I was lucky enough to tell the difference between

    document.frm1.SFName.readonly = false;

    and

    document.frm1.SFName.readOnly = false;

    which is right.

    BTW, you better use the readonly="true" variant because it is valid even in XHTML.
    Faq

  4. #4
    Shadow Wizard's Avatar
    Shadow Wizard is offline Moderator From Beyond
    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,126
    Rep Power
    2921
    nice, you repeated my reply. excellent job.
    hope you enjoyed it.
    --thread closed.
    Faq

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. change text value in javascript
    By nofriends in forum ASP Development
    Replies: 4
    Last Post: December 22nd, 2004, 06:30 AM
  2. javascript to change images and a style attribute on rollover?
    By trevorsaint in forum HTML, JavaScript And CSS Help
    Replies: 12
    Last Post: November 17th, 2004, 11:01 AM
  3. Using javascript to change session value
    By koolgift in forum ASP Development
    Replies: 3
    Last Post: October 20th, 2004, 01:18 AM
  4. change the property office files
    By Orhaii in forum .NET Development
    Replies: 0
    Last Post: September 24th, 2004, 01:50 PM
  5. Imagebutton Mouseover/Onclick
    By vjmehra in forum .NET Development
    Replies: 3
    Last Post: August 26th, 2004, 11:29 AM

ASP Free Advertisers and Affiliates