...

View Full Version : Code not working in Mozilla



Red Mercury
02-01-2005, 12:55 AM
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>

Brandoe85
02-01-2005, 12:56 AM
You should be using document.getElementById();

_Aerospace_Eng_
02-01-2005, 01:01 AM
this works in IE and FF

<!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>

Red Mercury
02-01-2005, 06:44 PM
Many thanks to you guys for giving me a solution so quickly. That page now works fine in the the two browsers.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum