Script Categories













Background Effects >>> Write Layer.

Display, hide, and change layers in all browsers.

layer-text
hide layer | show layer | layer-text #1 | layer-text #2

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function hidelayer(lay) {
if (ie4||ns6) {document.getElementById([lay]).style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
}
function showlayer(lay) {
if (ie4||ns6) {document.getElementById([lay]).style.visibility = "visible";}
if (ns4) {document.layers[lay].visibility = "show";}
}
function writetolayer(lay,txt) {
if (ie4) {
document.all[lay].innerHTML = txt;
}
if (ns4) {
document[lay].document.write(txt);
document[lay].document.close();
}
if (ns6) {
over = document.getElementById([lay]);
range = document.createRange();
range.setStartBefore(over);
domfrag = range.createContextualFragment(txt);
while (over.hasChildNodes()) {
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
   }
}
//  End -->
</script>
<center>
<
SPAN ID="newlayer">layer-text</SPAN>
<
br>
<a href="javascript:hidelayer('newlayer');">hide layer</a> |
<a href="javascript:showlayer('newlayer');">show layer</a> |
<a href="javascript:writetolayer('newlayer','layer-text #1');">layer-text #1</a> |
<a href="javascript:writetolayer('newlayer','layer-text #2');">layer-text #2</a>
</center>

Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©