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
    New Coder
    Join Date
    Sep 2011
    Location
    127.0.0.1
    Posts
    67
    Thanks
    19
    Thanked 0 Times in 0 Posts

    document.getElementById(msg) is null

    Hi....I have an error in my script, but idk where it is..... here is the script:

    Code:
    <script type="text/javascript">
    var browser = navigator.appName;
    if (browser=="Netscape") {
    document.getElementById(msg).style.display="none";
    }
    </script>
    <div id="msg" style="width:100%;padding:3px;position:fixed;top:0px;left:0px;background:red;">Please install <a href="http://www.mozilla.org/sk/firefox/">Mozilla Firefox</a> to view this page normally.</div>

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    Code:
    document.getElementById('msg').style.display="none";

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    also the script block should be after the div element in this example.

  • Users who have thanked DanInMa for this post:

    sonic656 (09-28-2011)

  • #4
    New Coder
    Join Date
    Sep 2011
    Location
    127.0.0.1
    Posts
    67
    Thanks
    19
    Thanked 0 Times in 0 Posts
    not working with:
    Code:
    document.getElementById('msg').style.display="none";

  • #5
    New Coder
    Join Date
    Sep 2011
    Location
    127.0.0.1
    Posts
    67
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DanInMa View Post
    also the script block should be after the div element in this example.
    THX MAN!!!!! it is working!!! your great!

  • #6
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    In all fairness you needed both changes for your code to work

  • Users who have thanked blaze4218 for this post:

    sonic656 (09-29-2011)

  • #7
    New Coder
    Join Date
    Sep 2011
    Location
    127.0.0.1
    Posts
    67
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Thx for help

  • #8
    New Coder
    Join Date
    Sep 2011
    Location
    127.0.0.1
    Posts
    67
    Thanks
    19
    Thanked 0 Times in 0 Posts
    PHP Code:
    <?php

    echo "Thank you blaze4218";

    ?>


  •  

    Posting Permissions

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