byrdley20
08-26-2003, 02:51 PM
I am having trouble accessing an image that is within a layer in Netscape 4. I have searched all over and found that the common solution is using:
document.layers["layer1"].document.images["contactus"].src
I tried this but I get the error:
document.layers.layer1.document.images.contactus has no
properties.
Here is some code. Can someone please help me.
function showLayer2()
{
if(document.getElementById)
{
document.getElementById("layer2").style.visibility = 'visible';
}
else if(document.layers)
{
document.layers["layer2"].visibility = 'visible';
alert(document.layers["layer1"].document.images["contactus"].src);
}
}
function hideLayer2()
{
if(document.getElementById)
{
document.getElementById("layer2").style.visibility = 'hidden';
}
else if(document.layers)
{
document.layers["layer2"].visibility = 'hidden';
}
}
And here is the html:
<layer name="layer1">
<div id="layer1" style="position:absolute;">
<a href = "#"><img src=../images/menutools_signout.gif border="0" name="signout"></a>
<a href="#" onMouseOver="showLayer2()" onMouseOut="hideLayer2()"><img src=../images/menutools_contactus.gif border="0" name="contactus"></a>
</div>
</layer>
<layer name="layer2">
<div id="layer2" style="position:absolute; width:90; text-color:#003399; border:1px solid; background:#F5F5E1" onMouseOver="showLayer2()" onMouseOut="hideLayer2()">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td valign="center" style="width:100%; background-color:#F5F5E1" onMouseOver="this.style.backgroundColor='white';" onMouseOut="this.style.backgroundColor='#F5F5E1';">
<span class="subMenu">
<a href = "email" style="font-size:12px;" target="_blank">E-mail Us</a>
</span>
</td>
</tr>
<tr>
<td valign="center" style="width:100%; background-color:#F5F5E1" onMouseOver="this.style.backgroundColor='white';" onMouseOut="this.style.backgroundColor='#F5F5E1';">
<span class="subMenu">
<a href = "survey" style="font-size:12px;" target="_blank">Survey</a>
</span>
</td>
</tr>
</table>
</div>
</layer>
Please help me. Thank you.
document.layers["layer1"].document.images["contactus"].src
I tried this but I get the error:
document.layers.layer1.document.images.contactus has no
properties.
Here is some code. Can someone please help me.
function showLayer2()
{
if(document.getElementById)
{
document.getElementById("layer2").style.visibility = 'visible';
}
else if(document.layers)
{
document.layers["layer2"].visibility = 'visible';
alert(document.layers["layer1"].document.images["contactus"].src);
}
}
function hideLayer2()
{
if(document.getElementById)
{
document.getElementById("layer2").style.visibility = 'hidden';
}
else if(document.layers)
{
document.layers["layer2"].visibility = 'hidden';
}
}
And here is the html:
<layer name="layer1">
<div id="layer1" style="position:absolute;">
<a href = "#"><img src=../images/menutools_signout.gif border="0" name="signout"></a>
<a href="#" onMouseOver="showLayer2()" onMouseOut="hideLayer2()"><img src=../images/menutools_contactus.gif border="0" name="contactus"></a>
</div>
</layer>
<layer name="layer2">
<div id="layer2" style="position:absolute; width:90; text-color:#003399; border:1px solid; background:#F5F5E1" onMouseOver="showLayer2()" onMouseOut="hideLayer2()">
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td valign="center" style="width:100%; background-color:#F5F5E1" onMouseOver="this.style.backgroundColor='white';" onMouseOut="this.style.backgroundColor='#F5F5E1';">
<span class="subMenu">
<a href = "email" style="font-size:12px;" target="_blank">E-mail Us</a>
</span>
</td>
</tr>
<tr>
<td valign="center" style="width:100%; background-color:#F5F5E1" onMouseOver="this.style.backgroundColor='white';" onMouseOut="this.style.backgroundColor='#F5F5E1';">
<span class="subMenu">
<a href = "survey" style="font-size:12px;" target="_blank">Survey</a>
</span>
</td>
</tr>
</table>
</div>
</layer>
Please help me. Thank you.