I
imatts
Hi can anyone help with this little problem. I have a simple script to
swap between two divs on a page. It works perfectly in Firefox & Safari
& Opera. It fails in IE 6 giving Object Required error on initializing
second variable var layer2. I can't get to the bottom of this. Can
anyone help?
<script type="text/javascript">
function showhide(element) {
var layer1 = document.getElementById('layer1').style;
var layer2 = document.getElementById('layer2').style;
if (element == "php"){
layer1.visibility= "hidden";
layer2.visibility= "visible";
}
else if (element == "java") {
layer2.visibility= "hidden";
layer1.visibility= "visible";
}
}
</script>
<div id="layer1" style="visibility:visible">
<a href="javascript:showhide('php');">Click here for some PHP
examples</a>
.....</div>
<div id="layer2" style="visibility:hidden">
<a href="javascript:showhide('java');">Click here to see Java
examples</a>
.....</div>
Thanks. Matt
swap between two divs on a page. It works perfectly in Firefox & Safari
& Opera. It fails in IE 6 giving Object Required error on initializing
second variable var layer2. I can't get to the bottom of this. Can
anyone help?
<script type="text/javascript">
function showhide(element) {
var layer1 = document.getElementById('layer1').style;
var layer2 = document.getElementById('layer2').style;
if (element == "php"){
layer1.visibility= "hidden";
layer2.visibility= "visible";
}
else if (element == "java") {
layer2.visibility= "hidden";
layer1.visibility= "visible";
}
}
</script>
<div id="layer1" style="visibility:visible">
<a href="javascript:showhide('php');">Click here for some PHP
examples</a>
.....</div>
<div id="layer2" style="visibility:hidden">
<a href="javascript:showhide('java');">Click here to see Java
examples</a>
.....</div>
Thanks. Matt