EllenM1
12-20-2004, 11:58 PM
Hi - I am trying to create a script that will open a new page (flowchart) and make some layers on it visible, and some layers hidden.
The exact layers to be turned on and off are specified in the link containing the onClick event. There are 5 layers on the newly opened page, including PoorSittingPosture and Agitation - and I just checked the spelling and case again to make sure it matches.
My problem is: this works fine in IE but not in anything else. I get this error:
Error: flowchart.document.getElementById(selectedLayer) has no properties
Source File: http://path.to.server/commandtest.htm#
Line: 17
Anyone have any ideas?
Thanks,
Ellen
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
var flowchart;
function openwindow()
{
flowchart = window.open('http://path.to.server/index.htm','','flowchart');
}
function switchLayers(selectedLayer, deselectedLayer)
{
flowchart.document.getElementById(selectedLayer).style.visibility = 'visible';
flowchart.document.getElementById(deselectedLayer).style.visibility = 'hidden';
return false;
}
-->
</script>
</head>
<body>
<a href="#" onClick="openwindow(); switchLayers('PoorSittingPosture', 'Agitation')">Click to go to xxx </a>
</body>
</html>
The exact layers to be turned on and off are specified in the link containing the onClick event. There are 5 layers on the newly opened page, including PoorSittingPosture and Agitation - and I just checked the spelling and case again to make sure it matches.
My problem is: this works fine in IE but not in anything else. I get this error:
Error: flowchart.document.getElementById(selectedLayer) has no properties
Source File: http://path.to.server/commandtest.htm#
Line: 17
Anyone have any ideas?
Thanks,
Ellen
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
var flowchart;
function openwindow()
{
flowchart = window.open('http://path.to.server/index.htm','','flowchart');
}
function switchLayers(selectedLayer, deselectedLayer)
{
flowchart.document.getElementById(selectedLayer).style.visibility = 'visible';
flowchart.document.getElementById(deselectedLayer).style.visibility = 'hidden';
return false;
}
-->
</script>
</head>
<body>
<a href="#" onClick="openwindow(); switchLayers('PoorSittingPosture', 'Agitation')">Click to go to xxx </a>
</body>
</html>