|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
Iniciado por NOSPAMbizwizapps, 29,ene. 2004 01:28 - 1 respuesta |
| |
| | | |
|
| |
Publicado el 29,enero 2004 - 01:28 |
Hi All Here some code (Java) That I use as a background on a Rental app It shows an Analog Clock in the right hand Corner off the screen, It will actualy reposition On a Scrollable Window to stay in the same Position. You can change the Background colour, look at the code. I am pasting it here, be aware that some unecessary carriage Returns may happen due to the NG format. Anyway, copy the code and save it as .html Enjoy and Keep well Peter Purton -----------------------------------------------------------
fCol='FFFFFF'; //face colour. sCol='FF0000'; //seconds colour. mCol='FFFFFF'; //minutes colour. hCol='FFFFFF'; //hours colour. Ybase@; //Clock height. Xbase@; //Clock width.
H='...'; H=H.split(''); M='....'; M=M.split(''); S='.....'; S=S.split(''); NS4=(document.layers); NS6=(document.getElementById&&!document.all); IE4=(document.all); Ypos=0; Xpos=0; dots; Split60/dots; if (NS6){ for (i=1; i < dots+1; i++){ document.write(' '+i+''); } for (i=0; i < M.length; i++){ document.write(''); } for (i=0; i < H.length; i++){ document.write(''); } for (i=0; i < S.length; i++){ document.write(''); } } if (NS4){ dgts='1 2 3 4 5 6 7 8 9 10 11 12'; dgts=dgts.split(' ') for (i=0; i < dots; i++){ document.write(' '+dgts[i]+' '); } for (i=0; i < M.length; i++){ document.write(''); } for (i=0; i < H.length; i++){ document.write(''); } for (i=0; i < S.length; i++){ document.write(''); } } if (IE4){ document.write(''); for (i=1; i < dots+1; i++){ document.write(''+i+''); } document.write('') document.write(''); for (i=0; i < M.length; i++){ document.write(''); } document.write('') document.write(''); for (i=0; i < H.length; i++){ document.write(''); } document.write('') document.write(''); for (i=0; i < S.length; i++){ document.write(''); } document.write('') } function clock(){ time = new Date (); secs = time.getSeconds(); sec = -1.57 + Math.PI * secs/30; mins = time.getMinutes(); min = -1.57 + Math.PI * mins/30; hr = time.getHours(); hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360; if (NS6){ Ypos=window.pageYOffset+Ybase+25; Xpos=window.pageXOffset+window.innerWidth-Xbase-30; for (i=1; i < dots+1; i++){ document.getElementById("n6Digits"+i).style.top=Ypos-15+Ybase*Math.sin(-1.56 +i *Split*Math.PI/180) document.getElementById("n6Digits"+i).style.left=Xpos-15+Xbase*Math.cos(-1.56 +i*Split*Math.PI/180) } for (i=0; i < S.length; i++){ document.getElementById("Nx"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(sec); document.getElementById("Nx"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(sec); } for (i=0; i < M.length; i++){ document.getElementById("Ny"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(min); document.getElementById("Ny"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(min); } for (i=0; i < H.length; i++){ document.getElementById("Nz"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(hrs); document.getElementById("Nz"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(hrs); } } if (NS4){ Ypos=window.pageYOffset+Ybase+20; Xpos=window.pageXOffset+window.innerWidth-Xbase-30; for (i=0; i < dots; ++i){ document.layers["nsDigits"+i].top=Ypos-5+Ybase*Math.sin(-1.045 +i*Split*Math.PI/180) document.layers["nsDigits"+i].left=Xpos-15+Xbase*Math.cos(-1.045 +i*Split*Math.PI/180) } for (i=0; i < S.length; i++){ document.layers["nx"+i].top=Ypos+i*Ybase/4.1*Math.sin(sec); document.layers["nx"+i].left=Xpos+i*Xbase/4.1*Math.cos(sec); } for (i=0; i < M.length; i++){ document.layers["ny"+i].top=Ypos+i*Ybase/4.1*Math.sin(min); document.layers["ny"+i].left=Xpos+i*Xbase/4.1*Math.cos(min); } for (i=0; i < H.length; i++){ document.layers["nz"+i].top=Ypos+i*Ybase/4.1*Math.sin(hrs); document.layers["nz"+i].left=Xpos+i*Xbase/4.1*Math.cos(hrs); } } if (IE4){ Ypos=document.body.scrollTop+Ybase+20; Xpos=document.body.scrollLeft+window.document.body.clientWidth-Xbase-20; for (i=0; i < dots; ++i){ ieDigits[i].style.pixelTop=Ypos-15+Ybase*Math.sin(-1.045 +i *Split*Math.PI/180) ieDigits[i].style.pixelLeft=Xpos-15+Xbase*Math.cos(-1.045 +i *Split*Math.PI/180) } for (i=0; i < S.length; i++){ x[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(sec); x[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(sec); } for (i=0; i < M.length; i++){ y[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(min); y[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(min); } for (i=0; i < H.length; i++){ z[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(hrs); z[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(hrs); } } setTimeout('clock()',100); } clock(); //-->
------------------------------------------------------ |
| |
| |
| | | |
|
| | |
| |
Publicado el 29,enero 2004 - 01:31 |
Just looked It did not paste too well. Just email me and I will send you the code. Take out the NOSPAM off course. Keep well Peter Purton
Hi All Here some code (Java) That I use as a background on a Rental app It shows an Analog Clock in the right hand Corner off the screen, It will actualy reposition On a Scrollable Window to stay in the same Position. You can change the Background colour, look at the code. I am pasting it here, be aware that some unecessary carriage Returns may happen due to the NG format. Anyway, copy the code and save it as .html Enjoy and Keep well Peter Purton -----------------------------------------------------------
fCol='FFFFFF'; //face colour. sCol='FF0000'; //seconds colour. mCol='FFFFFF'; //minutes colour. hCol='FFFFFF'; //hours colour. Ybase@; //Clock height. Xbase@; //Clock width.
H='...'; H=H.split(''); M='....'; M=M.split(''); S='.....'; S=S.split(''); NS4=(document.layers); NS6=(document.getElementById&&!document.all); IE4=(document.all); Ypos=0; Xpos=0; dots; Split60/dots; if (NS6){ for (i=1; i < dots+1; i++){ document.write(' '+i+'');
} for (i=0; i < M.length; i++){ document.write(''); } for (i=0; i < H.length; i++){ document.write(''); } for (i=0; i < S.length; i++){ document.write(''); } } if (NS4){ dgts='1 2 3 4 5 6 7 8 9 10 11 12'; dgts=dgts.split(' ') for (i=0; i < dots; i++){ document.write(' '+dgts[i]+' ');
} for (i=0; i < M.length; i++){ document.write(''); } for (i=0; i < H.length; i++){ document.write(''); } for (i=0; i < S.length; i++){ document.write(''); } } if (IE4){ document.write(''); for (i=1; i < dots+1; i++){ document.write(''+i+''); } document.write('') document.write(''); for (i=0; i < M.length; i++){ document.write(''); } document.write('') document.write(''); for (i=0; i < H.length; i++){ document.write(''); } document.write('') document.write(''); for (i=0; i < S.length; i++){ document.write(''); } document.write('') } function clock(){ time = new Date (); secs = time.getSeconds(); sec = -1.57 + Math.PI * secs/30; mins = time.getMinutes(); min = -1.57 + Math.PI * mins/30; hr = time.getHours(); hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360; if (NS6){ Ypos=window.pageYOffset+Ybase+25; Xpos=window.pageXOffset+window.innerWidth-Xbase-30; for (i=1; i < dots+1; i++){ document.getElementById("n6Digits"+i).style.top=Ypos-15+Ybase*Math.sin(-1.56 +i *Split*Math.PI/180) document.getElementById("n6Digits"+i).style.left=Xpos-15+Xbase*Math.cos(-1.56 +i*Split*Math.PI/180) } for (i=0; i < S.length; i++){ document.getElementById("Nx"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(sec); document.getElementById("Nx"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(sec); } for (i=0; i < M.length; i++){ document.getElementById("Ny"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(min); document.getElementById("Ny"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(min); } for (i=0; i < H.length; i++){ document.getElementById("Nz"+i).style.top=Ypos+i*Ybase/4.1*Math.sin(hrs); document.getElementById("Nz"+i).style.left=Xpos+i*Xbase/4.1*Math.cos(hrs); } } if (NS4){ Ypos=window.pageYOffset+Ybase+20; Xpos=window.pageXOffset+window.innerWidth-Xbase-30; for (i=0; i < dots; ++i){ document.layers["nsDigits"+i].top=Ypos-5+Ybase*Math.sin(-1.045 +i*Split*Math.PI/180) document.layers["nsDigits"+i].left=Xpos-15+Xbase*Math.cos(-1.045 +i*Split*Math.PI/180) } for (i=0; i < S.length; i++){ document.layers["nx"+i].top=Ypos+i*Ybase/4.1*Math.sin(sec); document.layers["nx"+i].left=Xpos+i*Xbase/4.1*Math.cos(sec); } for (i=0; i < M.length; i++){ document.layers["ny"+i].top=Ypos+i*Ybase/4.1*Math.sin(min); document.layers["ny"+i].left=Xpos+i*Xbase/4.1*Math.cos(min); } for (i=0; i < H.length; i++){ document.layers["nz"+i].top=Ypos+i*Ybase/4.1*Math.sin(hrs); document.layers["nz"+i].left=Xpos+i*Xbase/4.1*Math.cos(hrs); } } if (IE4){ Ypos=document.body.scrollTop+Ybase+20; Xpos=document.body.scrollLeft+window.document.body.clientWidth-Xbase-20; for (i=0; i < dots; ++i){ ieDigits[i].style.pixelTop=Ypos-15+Ybase*Math.sin(-1.045 +i *Split*Math.PI/180) ieDigits[i].style.pixelLeft=Xpos-15+Xbase*Math.cos(-1.045 +i *Split*Math.PI/180) } for (i=0; i < S.length; i++){ x[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(sec); x[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(sec); } for (i=0; i < M.length; i++){ y[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(min); y[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(min); } for (i=0; i < H.length; i++){ z[i].style.pixelTop =Ypos+i*Ybase/4.1*Math.sin(hrs); z[i].style.pixelLeft=Xpos+i*Xbase/4.1*Math.cos(hrs); } } setTimeout('clock()',100); } clock(); //-->
------------------------------------------------------
|
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|