...

View Full Version : Netscape 4: Changing text within a layer



Oakendin
07-23-2002, 02:00 AM
I am having a Netscape Text layer changing problem

I have a hidden layer with text. When an image is clicked somewhere else on the page, I want the text within the layer to change and than make the layer unhidden.

I am successful with IE, but cannot find a solution for Netscape 4. Any help would be great.

Here’s the code I have so far:

Javascript:
function showMessage(messageId,id_hide) {
if (document.layers){ // nn4
document.layers[messageId].visibility='show';
}else if (document.all){ // ie
document.all(messageId).style.visibility='visible';
}else if (document.getElementById){ // nn6
document.getElementById(messageId).style.visibility='visible';
}
}

function showHiddenDiv(messageId) {
if (document.layers){ // nn4
document.layers[messageId].document.open();
document.layers[messageId].document.write("print something");
document.layers[messageId].document.close();
}else if (document.all){ // ie
document.all(messageId).innerText = "Hello";
}else if (document.getElementById){ // nn6
document.getElementById(messageId).style.visibility='hidden';
}
if (document.layers){ // nn4
if (document.layers[messageId].visibility == "show") {
hideMessage(messageId);
}
else {
showMessage(messageId);
}
}else if (document.all){ // ie
if (document.all(messageId).style.visibility == "visible") {
hideMessage(messageId);
}
else {
showMessage(messageId);
}
}else if (document.getElementById){ // nn6
document.getElementById(messageId).style.visibility='visible';
}
}


HTML (in a table cell):
<div style="position: relative; visibility: hidden" id="divtest" nohref>Rapid Registry</div>

Link Event:
<a href="javascript:showHiddenDiv('divtest');">divtest layer</a><br>

adios
07-23-2002, 02:44 AM
You said the magic word: table. Uh-oh.


<HTML>
<HEAD>
<TITLE>untitled</TITLE>
<script type="text/javascript">

function showMessage(messageId,id_hide) {
if (document.layers){ // nn4
document['NS_' + messageId].document.layers[0].visibility='show';
}else if (document.all){ // ie
document.all(messageId).style.visibility='visible';
}else if (document.getElementById){ // nn6
document.getElementById(messageId).style.visibility='visible';
}
}

function showHiddenDiv(messageId) {
if (document.layers){ // nn4
var l = document['NS_' + messageId].document.layers[0];
l.document.write('<span style="font:200 16px arial;">print something</span>');
l.document.close();
}else if (document.all){ // ie
document.all(messageId).innerHTML = "Hello";
document.all(messageId).style.font='bold 24px helvetica';
}else if (document.getElementById){ // nn6
document.getElementById(messageId).style.visibility='hidden';
}
if (document.layers){ // nn4
if (l.visibility == "show") {
hideMessage(messageId);
}
else {
showMessage(messageId);
}
}else if (document.all){ // ie
if (document.all(messageId).style.visibility == "visible") {
hideMessage(messageId);
}
else {
showMessage(messageId);
}
}else if (document.getElementById){ // nn6
document.getElementById(messageId).style.visibility='visible';
}
}
</script>
</HEAD>
<BODY>
<table bgcolor="skyblue"><tr>
<td id="divtest" width="100"><ilayer id="NS_divtest"><layer width="100">Rapid Registry
</layer></ilayer></td></tr></table>

<a href="javascript&#58;void showHiddenDiv('divtest')">divtest layer</a><br>
</BODY>
</HTML>


The <td><ilayer><layer></layer></ilayer></td> nonsense is about the only thing that holds 'em in there. The id for the <ilayer> can't be the same as the <td> since IE parses everything. The void in the link keeps it from loading. hth



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum