PDA

Click to See Complete Forum and Search --> : Layers! Woohoo!


filburt1
Mar 29th, 2002, 09:23 PM
I made a nice happy layer:

<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?

crptcblade
Mar 29th, 2002, 09:42 PM
IE

<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.

:)

filburt1
Mar 29th, 2002, 10:02 PM
What about evil NS4?

crptcblade
Mar 29th, 2002, 10:05 PM
Originally posted by filburt1
What about evil NS4?

I refuse to test stuff for NS, but I imagine that it won't work.

;)

punkpie_uk
Mar 30th, 2002, 03:55 AM
In NS4 its ...


with(document.layers[layerID].document){
open();
write(txt);
close();
}


..but use this function I wrote, Its cross-browser complient...


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();
}
}
}

filburt1
Mar 30th, 2002, 09:28 AM
Cheers, I'll try it out :)

filburt1
Mar 30th, 2002, 10:43 AM
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?

The Hobo
Mar 30th, 2002, 12:06 PM
http://www.dynamicdrive.com/dynamicindex5/linkdescribe.htm
http://www.dynamicdrive.com/dynamicindex5/linkinfo.htm
http://www.dynamicdrive.com/dynamicindex5/linkinfo2.htm

Any of those help?

chrisjk
Mar 30th, 2002, 12:08 PM
Why you so concerned about NS4...that's well old hat now. 6.2 is out

filburt1
Mar 30th, 2002, 02:04 PM
Still doesn't hurt to be compliant...

Hobo: Checking those out now...

filburt1
Mar 30th, 2002, 02:06 PM
OMG, it was already clearing what was in the layer, stupid me :rolleyes:

Bah, fine Chris, screw NS4 :p

chrisjk
Mar 30th, 2002, 06:52 PM
Originally posted by filburt1
Bah, fine Chris, screw NS4 :p amen brother