<HTML><HEAD><TITLE></TITLE>
<script language="JavaScript">
<!--
Timeout=5000 // set delay time for effect
Timer=""
function oStatic() {
clearTimeout(Timer)
if(timerRunning == true||blurred==1){ // if win1 opened or opener is blurred,
return
return
}
timerRunning = true
win1=window.open("s_saver.htm",'','fullscreen') // if win1 not opened,
open win1
Timer=setTimeout("oStatic()",Timeout) // run function oStatic after
delay
}
opened=0 // win1 not opened
function oActive(){ //
clearTimeout(Timer)
if(opened==1){return} // if win1 opened, return
timerRunning = false
Timer=setTimeout("oStatic()",Timeout) // if win1 not opened run function
oStatic after delay
}
document.onmousemove=oActive // detect mouse movement
document.onmousedown=oActive // detect if button pressed
document.onkeypress=oActive // detect if key press
setTimeout("oActive()",1000)
//-->
</script>
</HEAD><BODY onblur="blurred='1'" onfocus="blurred='0';oActive()">
<h1><center>Screen Saver con Dhtml</center></h1>
Non muovere il mouse per <script>document.write(Timeout/1000);</script> secondi
e vedrai apparire lo screen saver scritto con Dhtml.
</BODY>
</HTML>
Il file dello screensaver (s_saver.htm)
<HTML xmlns:v = "urn:schemas-microsoft-com:vml">
<HEAD><TITLE></TITLE>
<style>
v\:* {BEHAVIOR: url(#default#VML)}
body{
scrollbar-Face-Color:#000000;
scrollbar-Base-Color:#000000;
scrollbar-DarkShadow-Color:#000000;
scrollbar-3dLight-Color:#000000;
scrollbar-Arrow-Color:#000000;
scrollbar-Highlight-Color:#000000;
scrollbar-Shadow-Color:#000000;
scrollbar-Track-Color:#000000;
}
</style>
<script language="JavaScript">
<!--
// ********** Child Screensaver Script **********
// Realised by apacheJeff
// www.huntingground.freeserve.co.uk
function init(){
opener.opened=1
ignore=0 // ignore busy cursor when page loads
document.onmousemove=gone // detect mouse movement
document.onmousedown=gone // detect if button pressed
document.onkeypress=gone // detect if key press
}
function gone(){
if(ignore==0){
ignore=1
return}
opener.opened=0
self.close()
}
setTimeout("init()",1000)
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Init(){
W=document.body.clientWidth
H=document.body.clientHeight
posx=Math.round(Math.random()*W)
posy=Math.round(Math.random()*H)
randomX()
randomY()
}
step=10
speed=50
function randomX(){
randx = Math.round(Math.random()*W);
if( randx > W ){
randomX();
}
}
function moveX(){
if (posx>= randx-step&&posx<=randx+step){
randomX();
}
(posx<randx?posx+=step:posx-=step)
motion();
setTimeout("moveX()", speed);
}
function randomY(){
randy = Math.round(Math.random()*H);
if( randy > H ){
randomY();
}
}
function moveY(){
if (posy>=randy-step&&posy<=randy+step){
randomY();
}
(posy<randy?posy+=step:posy-=step)
motion();
setTimeout("moveY()", speed);
}
function motion(){
moveme1.style.pixelLeft=posx
moveme1.style.pixelTop=posy
moveme1.style.visibility="visible"
}
setTimeout("moveX();moveY()",1000)
setTimeout("Init()",750)
// -->
</script>
</HEAD><BODY bgcolor="black">
<DIV ID="moveme1" STYLE="position: absolute; left:10; top:10;color:gold;visibility:hidden">
<v:oval style="position:relative;left:0px;top:0px;width:40px; height:40px" fillcolor
= "red">
<v:fill type="gradientRadial" color2="white" method="sigma" focusposition="0.2,0.2" focussize="0.1,0.1"></v:fill>
</DIV>
</BODY></HTML>