help regarding document.getElementById('').styles.display

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    help regarding document.getElementById('').styles.display

    hi there i am amking an inventory application with php,ajax,javasc ript,html,dhtml ,sql
    the problem is that i have hidden the input fields regarding the replace no's of the parts with this line of code

    Code:
            document.getElementById('bgrp1').style.visibility='hidden';
    	document.getElementById('lable_rp_no1').style.display='none';
    	document.getElementById('rp_no1').style.display='hidden';
    the code for the html part is here

    [HTML]
    <tr><td class="add" id="bgrp1"><di v align="left" id="lable_rp_no 1">Replace No1:</div></td>
    <td width="150" align="Center" valign="Center" ><div align="left" id="div_rp_no1 " class="addinp"> <input name="rp_no1" type="text" size="25" ></div></td>
    </tr>
    [/HTML]

    the problem is that it runs absolutely perfect in the internet explorer, and hides the input fields also ,but when i try to run it in the FIREFOX it gives me error on the line

    document.getEle mentById('rp_no 1').style.displ ay='hidden';

    and the error is
    Code:
    Error: document.getElementById("rp_no1") has no properties
    Source File: http://localhost/ashar/js/Ad_stk2.js
    Line: 346
    any suggestions for this awaiting reply ,
    regards,
    omer
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    There's no element with id rp_no1. IE erroneously allows you to access elements by id using their name, rather than the id only.

    Comment

    • omerbutt
      Contributor
      • Nov 2006
      • 638

      #3
      Originally posted by acoder
      There's no element with id rp_no1. IE erroneously allows you to access elements by id using their name, rather than the id only.
      sir i even gave the id="rp_no1" in the input field but it still gives me the same error

      Comment

      • omerbutt
        Contributor
        • Nov 2006
        • 638

        #4
        Originally posted by omerbutt
        sir i even gave the id="rp_no1" in the input field but it still gives me the same error
        hey sorry for the last post it solved my problem sir
        regards,
        omer.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Glad to hear that you got it working. Remember that getElementById means ID only.

          Comment

          Working...