DHTML Tutorials

DHTML in NS
Previous Home Next

DHTML in NS 4 is quite simple, and comes down to essentially one word- Layer. I was pretty astonished myself, but its true- NS 4 relies completely on a new tag, called the <layer> tag, to spin up its DHTML magic. This new tag is dynamic in that it can be positioned anywhere on a web page (without relation to other content), moved around, its content inside updated on demand, and more.</layer>

Syntax

<layer id="test" width=80px height=80px></layer>
<script language="JavaScript1.2">
//variable that helps alternate between red and blue
var thecolor=true
//Apply a bgColor of blue as the initial layer color
document.test1.bgColor="blue"
function changecol(){
//if thecolor=true
if (thecolor)
document.test.bgColor="blue"
else
document.test.bgColor="red"
//set thecolor to the opposite of its current state
thecolor=!thecolor
setTimeout("changecol()",1000)
}
changecol()
</script>
Previous Home Next