|
-
Mar 29th, 2002, 10:23 PM
#1
Thread Starter
Member
Layers! Woohoo!
I made a nice happy layer:
Code:
<div id="desc" style="position:static; z-index:1">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Move the mouse over the icons above to
see their descriptions.</font>
</div>
Using Javascript, how can I clear the contents of the layer and write new text to it?
-
Mar 29th, 2002, 10:42 PM
#2
IE
Code:
<script>
function changeIt()
{
document.all.desc.innerHTML = "<b>I am not a pretty elf</b>"
}
</script>
<div id="desc" style="position:static; z-index:1">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Move the mouse over the icons above to
see their descriptions.</font>
</div>
That should work.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 29th, 2002, 11:02 PM
#3
Thread Starter
Member
-
Mar 29th, 2002, 11:05 PM
#4
Originally posted by filburt1
What about evil NS4?
I refuse to test stuff for NS, but I imagine that it won't work.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 30th, 2002, 04:55 AM
#5
Fanatic Member
In NS4 its ...
Code:
with(document.layers[layerID].document){
open();
write(txt);
close();
}
..but use this function I wrote, Its cross-browser complient...
Code:
function writeLayer(layerID,txt){
if(document.getElementById){
document.getElementById(layerID).innerHTML=txt;
}else if(document.all){
document.all[layerID].innerHTML=txt;
}else if(document.layers){
with(document.layers[layerID].document){
open();
write(txt);
close();
}
}
}
-
Mar 30th, 2002, 10:28 AM
#6
Thread Starter
Member
Cheers, I'll try it out
-
Mar 30th, 2002, 11:43 AM
#7
Thread Starter
Member
Well it writes to the layer, but it doesn't clear what's in the layer already. How would I do that using your cross-browser function?
-
Mar 30th, 2002, 01:06 PM
#8
Stuck in the 80s
-
Mar 30th, 2002, 01:08 PM
#9
PowerPoster
Why you so concerned about NS4...that's well old hat now. 6.2 is out
-
Mar 30th, 2002, 03:04 PM
#10
Thread Starter
Member
Still doesn't hurt to be compliant...
Hobo: Checking those out now...
-
Mar 30th, 2002, 03:06 PM
#11
Thread Starter
Member
OMG, it was already clearing what was in the layer, stupid me 
Bah, fine Chris, screw NS4
-
Mar 30th, 2002, 07:52 PM
#12
PowerPoster
Originally posted by filburt1
Bah, fine Chris, screw NS4
amen brother
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|