Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-28-2011, 07:19 PM   PM User | #1
sonic656
New Coder

 
Join Date: Sep 2011
Location: 127.0.0.1
Posts: 62
Thanks: 18
Thanked 0 Times in 0 Posts
sonic656 is an unknown quantity at this point
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>
sonic656 is offline   Reply With Quote
Old 09-28-2011, 07:23 PM   PM User | #2
blaze4218
Regular Coder

 
Join Date: Apr 2005
Location: Texas
Posts: 448
Thanks: 24
Thanked 63 Times in 63 Posts
blaze4218 is an unknown quantity at this point
Code:
document.getElementById('msg').style.display="none";
blaze4218 is offline   Reply With Quote
Old 09-28-2011, 08:01 PM   PM User | #3
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
also the script block should be after the div element in this example.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
sonic656 (09-28-2011)
Old 09-28-2011, 08:05 PM   PM User | #4
sonic656
New Coder

 
Join Date: Sep 2011
Location: 127.0.0.1
Posts: 62
Thanks: 18
Thanked 0 Times in 0 Posts
sonic656 is an unknown quantity at this point
not working with:
Code:
document.getElementById('msg').style.display="none";
sonic656 is offline   Reply With Quote
Old 09-28-2011, 08:23 PM   PM User | #5
sonic656
New Coder

 
Join Date: Sep 2011
Location: 127.0.0.1
Posts: 62
Thanks: 18
Thanked 0 Times in 0 Posts
sonic656 is an unknown quantity at this point
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!
sonic656 is offline   Reply With Quote
Old 09-28-2011, 08:34 PM   PM User | #6
blaze4218
Regular Coder

 
Join Date: Apr 2005
Location: Texas
Posts: 448
Thanks: 24
Thanked 63 Times in 63 Posts
blaze4218 is an unknown quantity at this point
In all fairness you needed both changes for your code to work
blaze4218 is offline   Reply With Quote
Users who have thanked blaze4218 for this post:
sonic656 (09-29-2011)
Old 09-29-2011, 03:59 PM   PM User | #7
sonic656
New Coder

 
Join Date: Sep 2011
Location: 127.0.0.1
Posts: 62
Thanks: 18
Thanked 0 Times in 0 Posts
sonic656 is an unknown quantity at this point
Thx for help
sonic656 is offline   Reply With Quote
Old 09-29-2011, 04:01 PM   PM User | #8
sonic656
New Coder

 
Join Date: Sep 2011
Location: 127.0.0.1
Posts: 62
Thanks: 18
Thanked 0 Times in 0 Posts
sonic656 is an unknown quantity at this point
PHP Code:
<?php

echo "Thank you blaze4218";

?>
sonic656 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:55 AM.


Advertisement
Log in to turn off these ads.