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 02-01-2005, 12:55 AM   PM User | #1
Red Mercury
New Coder

 
Join Date: Mar 2004
Location: Perthshire
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Red Mercury is an unknown quantity at this point
Code not working in Mozilla

Help required to make the following piece of code work in Mozilla. It works ok in I.E. but not in Mozilla. I’ve uploaded the page so you can see it in action.

Go to http://www.salmonfly.co.uk/test1.html to view the page.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
function show() {
eval("document.all.hiddenframe.style.display='block'");
}
function hide() {
eval("document.all.hiddenframe.style.display='none'");
}
</script>

</head>
<body>
<p>&nbsp;</p>
<p><img src="215x1.jpg" style="cursor: pointer; cursor:hand;" alt="Click to show iframe" onclick="show()"></p>
<div id="hiddenframe"; "layer1" style="display:none; z-index: 1;">
<iframe src="page2.html" style="position: absolute; left: 305px; top: 50px;
width: 400px; height: 300px;"></iframe>
<p><a onclick="hide()" style="cursor: pointer; cursor:hand;">click here to remove iframe</a></p>
</div>

</body>
</html>
Red Mercury is offline   Reply With Quote
Old 02-01-2005, 12:56 AM   PM User | #2
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
You should be using document.getElementById();
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 02-01-2005, 01:01 AM   PM User | #3
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
this works in IE and FF
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
function show() {
document.getElementById('hiddenframe').style.display='block';
}
function hide() {
document.getElementById('hiddenframe').style.display='none';
}
</script>

</head>
<body>
<p>&nbsp;</p>
<p><img src="215x1.jpg" style="cursor: pointer; cursor:hand;" alt="Click to show iframe" onclick="show()"></p>
<div id="hiddenframe" name="layer1" style="display:none; z-index: 1;">
<iframe src="page2.html" style="position: absolute; left: 305px; top: 50px; width: 400px; height: 300px;"></iframe>
<p><a onclick="hide()" style="cursor: pointer; cursor:hand;">click here to remove iframe</a></p>
</div>

</body>
</html>
_Aerospace_Eng_ is offline   Reply With Quote
Old 02-01-2005, 06:44 PM   PM User | #4
Red Mercury
New Coder

 
Join Date: Mar 2004
Location: Perthshire
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Red Mercury is an unknown quantity at this point
Thanks

Many thanks to you guys for giving me a solution so quickly. That page now works fine in the the two browsers.
Red Mercury 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 06:18 AM.


Advertisement
Log in to turn off these ads.