Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Text box highlight

    This javascript code works well in IE5+ but does not work on Netscape. Can someone please give me solution to work in Netscape also:

    Code:
    <script language="javascript"> 
    function yes() {
     MMDiv.Style.visibility='visible';
        form1.fieldname.focus();
    }
    </script>
    Form:

    Textbox under <div></div> tag has hidden value. so when clicked on yes, the textbox appears.
    Last edited by needhelp26; 07-15-2004 at 02:06 AM.

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    565
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Code:
    <script type="text/javascript"> 
    function yes() {
     document.getElementsByName('MMDiv')[0].style.visibility='visible';
     document.form1.fieldname.focus();
    }
    </script>
    If this doesn't help you, post the whole code so that we can find the error.

    dumpfi

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thankyou. I will try and if there is an error will post again with full code.

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Highlight ???
    Last edited by jamescover; 07-15-2004 at 05:07 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #5
    Regular Coder
    Join Date
    Jul 2004
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried that code and didn't work.

    Code:
    <script language="javascript"> 
    function yes() {
     MMDiv.Style.visibility='visible';
        form1.name.focus();
    }
    </script>
    Form:

    <table>
    <tr>
    <td><input type="radio" name="fieldname" value="yes" onclick="Yes();">Yes
    <div id="MMDIV" style="visibility:hidden">
    <input type "text" name="name" size="30"></div>
    </td>
    </tr>
    </table>

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Javascript is case-sensitive and you have to access elements properly.

    document.getElementById('MMDIV').style.visibility='visible';
    document.form1.name.focus();

  • #7
    Regular Coder
    Join Date
    Jul 2004
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried getElementById also, but it didn't work.

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Are you calling the correct function?
    Code:
    function yes() {
      document.getElementById('MMDIV').style.visibility='visible';
      document.form1.name.focus();
    }
    ...
    <input type="radio" name="fieldname" value="yes" onclick="yes();">
    You had a Yes() in the onclick in your original code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •