Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-23-2002, 01:00 AM   PM User | #1
Oakendin
New Coder

 
Join Date: Jul 2002
Location: Los Angeles
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Oakendin is an unknown quantity at this point
Netscape 4: Changing text within a layer

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>
Oakendin is offline   Reply With Quote
Old 07-23-2002, 01:44 AM   PM User | #2
adios
Senior Coder

 
Join Date: Jun 2002
Posts: 1,404
Thanks: 2
Thanked 32 Times in 32 Posts
adios is on a distinguished road
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: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
adios is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:34 AM.


Advertisement
Log in to turn off these ads.