装载页面进度条
|
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">
<title>预加载中....</title>
<style type="text/css">
<!--
.p { font-family: "MS Shell Dlg"; font-size: 12px}
-->
</style>
</head>
<body onLoad="location.href = url" oncontextmenu="window.event.returnValue=false" ondragstart="window.event.returnValue=false" onselectstart="event.returnValue=false">
<script language="JavaScript">
<!--
var url = 'http://www.niudun.com';
function jump(){
location=url;
return true;
}
//-->
</script>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" width="401" bordercolorlight="#808080" bordercolordark="#FFFFFF">
<tr>
<td bgcolor="#F5F5F5" width="402"> <div id=process style="width: 400; height: 10"> </div>
<script>
var num=0;
function mypro()
{
num++;
process.innerHTML=process.innerHTML+'<font color="#0000FF">■</font>';
if(num<26){setTimeout("mypro()",200);}else{process.innerHTML="";num=0;mypro()}
}
mypro();
</script>
</td> <script>
<!--
if (document.layers)
document.write('<Layer src="' + url + ' " VISIBILITY="hide"> </Layer>');
else
if (document.all || document.getElementById)
document.write('<iframe src="' + url + '" style="visibility: hidden;"></iframe>');
else location.href = url;
//-->
</script>
</tr>
</table>
</center>
</div>
<p align="center"><font class="p"><b>网站正在装载中,请稍候......</b></font></p>
</body>
</html>
网页代码:让用户等待若干秒才能点的表单按钮,页面读取进度条脚本.....
我先来一个:
让用户等待若干秒才能点的表单按钮。
<FORM name=sform action=reg_2.asp method=post><INPUT class=input type=submit value="我同意" name=submitbtn></FORM>
<SCRIPT language=javascript>
<!--
var secs = 15;
var wait = secs * 1000;
document.sform.submitbtn.disabled=true;
for(i=1;i<=secs;i++) {
window.setTimeout("update(" + i + ")", i * 1000);
}
window.setTimeout("timer()", wait);
function update(num) {
if(num == (wait/1000)) {
document.sform.submitbtn.value = "我同意";
}
else {
printnr = (wait/1000)-num;
document.sform.submitbtn.value = "请先阅读服务条款 (剩余时间" + printnr + ")";
}
}
function timer() {
document.sform.submitbtn.disabled=false;
}
//-->
</SCRIPT>
---------------------------------------------------------------
页面读取进度条脚本
复制代码到head
<style type="text/css">
/* Container of Loader */
#seLoader
{
width : 200px; /* set width of loader */
z-index : 1;
margin : auto;
}
/* Box around loadbar */
#seLoadBox
{
height : 12px; /* set height */
z-index : 3;
border : 1px solid;
padding : 1px;
background-color : #efefef;
font-size : 0px;
text-align : left;
}
/* loadbar */
#seLoadBar
{
width : 0%;
height : 100%;
z-index : 4;
background : #f90;
}
/* text (%) */
#seLoadTxt
{
z-index : 5;
margin-top : -14px;
font : 10px Verdana,Geneva,sans-serif;
}
</style>
<script src="seLoader.js" type="text/javascript"></script>
<script type="text/javascript">
load = new seLoader('img/') // make loader object and set the directory (dir optional)
load.runAtEnd('setTimeout(\'viewPage()\',10)') // run a script after loading (optional)
load.setImgs // set the images
(
'Image1.gif','Image2.gif','Image3.gif','Image4.gif','Image5.gif','Image6.gif','Image7.gif',
'Image8.gif','Image9.gif','Image10.gif','Image11.gif','Image12.gif','Image13.gif','Image14.gif','Image15.gif',
'Image16.gif','Image17.gif','Image18.gif','Image19.gif'
)
function viewPage()
{
location.replace('http://www.ceocio.net')
}
function initLoader()
{
load.load()
}
onload=initLoader
</script>
注明:
前半部分是设定进度条的颜色和规格
load = new seLoader('img/') // make loader object and set the directory (dir optional)
这里是设定读取图片的位置
(
'Image1.gif','Image2.gif','Image3.gif','Image4.gif','Image5.gif','Image6.gif','Image7.gif',
'Image8.gif','Image9.gif','Image10.gif','Image11.gif','Image12.gif','Image13.gif','Image14.gif','Image15.gif',
'Image16.gif','Image17.gif','Image18.gif','Image19.gif'
)
这里是读取图片的名字
复制代码到body
<div align="center">
<script>load.drawLoader('now loading...')</script>
</div>
---------------------------------------------------------------
动态时钟version1.0
<body>
<div id="Clock"></div>
<!--以上代码在页面中定义一个区域,区域名称为Clock-->
<script language=javascript>
<!--
function tick(){
var timeString=new Date().toLocaleString().slice(-8);
Clock.innerHTML=timeString;
}
setInterval("tick()",1000);
//-->
</script>
</body>
动态时钟version2.0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<SCRIPT language=JavaScript>
<!-- Begin
fCol = '000000'; //face colour.
sCol = 'ff0000'; //seconds colour.
mCol = '000000'; //minutes colour.
hCol = '0f0000'; //hours colour.
H = '....';
H = H.split('');
M = '.....';
M = M.split('');
S = '......';
S = S.split('');
Ypos = 0;
Xpos = 0;
Ybase = 8;
Xbase = 8;
dots = 12;
ns = (document.layers)?1:0;
if (ns) {
dgts = '1 2 3 4 5 6 7 8 9 10 11 12';
dgts = dgts.split(' ');
for (i = 0; i < dots; i++) {
document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial,Verdana size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');
}
for (i = 0; i < M.length; i++) {
document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
}
for (i = 0; i < H.length; i++) {
document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
}
for (i = 0; i < S.length; i++) {
document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
}
}
else {
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 1; i < dots+1; i++) {
document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial,Verdana;font-size:10px;color:'+fCol+';text-align:center;padding-top:10px" onclick=setminute('+i*5+') onmouseover="this.style.cursor=\'hand\'" onmouseout="this.style.cursor=\'\'">'+i+'</div>');
}
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < M.length; i++) {
document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');
}
document.write('</div></div>')
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < H.length; i++) {
document.write('<div id=z style="position:absolute;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');
}
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < S.length; i++) {
document.write('<div id=x style="position:absolute;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');
}
document.write('</div></div>')
}
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 (ns) {
Ypos = window.pageYOffset+window.innerHeight-60;
Xpos = window.pageXOffset+window.innerWidth-80;
}
else {
Ypos = document.body.scrollTop + window.document.body.clientHeight - 60;
Xpos = document.body.scrollLeft + window.document.body.clientWidth - 60;
}
if (ns) {
for (i = 0; i < dots; ++i){
document.layers["nsDigits"+i].top = Ypos - 5 + 40 * Math.sin(-0.49+dots+i/1.9);
document.layers["nsDigits"+i].left = Xpos - 15 + 40 * Math.cos(-0.49+dots+i/1.9);
}
for (i = 0; i < S.length; i++){
document.layers["nx"+i].top = Ypos + i * Ybase * Math.sin(sec);
document.layers["nx"+i].left = Xpos + i * Xbase * Math.cos(sec);
}
for (i = 0; i < M.length; i++){
document.layers["ny"+i].top = Ypos + i * Ybase * Math.sin(min);
document.layers["ny"+i].left = Xpos + i * Xbase * Math.cos(min);
}
for (i = 0; i < H.length; i++){
document.layers["nz"+i].top = Ypos + i * Ybase * Math.sin(hrs);
document.layers["nz"+i].left = Xpos + i * Xbase * Math.cos(hrs);
}
}
else{
for (i=0; i < dots; ++i){
ieDigits[i].style.pixelTop = Ypos - 15 + 40 * Math.sin(-0.49+dots+i/1.9);
ieDigits[i].style.pixelLeft = Xpos - 14 + 40 * Math.cos(-0.49+dots+i/1.9);
}
for (i=0; i < S.length; i++){
x[i].style.pixelTop = Ypos + i * Ybase * Math.sin(sec);
x[i].style.pixelLeft = Xpos + i * Xbase * Math.cos(sec);
}
for (i=0; i < M.length; i++){
y[i].style.pixelTop = Ypos + i * Ybase * Math.sin(min);
y[i].style.pixelLeft = Xpos + i * Xbase * Math.cos(min);
}
for (i=0; i < H.length; i++){
z[i].style.pixelTop = Ypos + i * Ybase*Math.sin(hrs);
z[i].style.pixelLeft = Xpos + i * Xbase*Math.cos(hrs);
}
}
setTimeout('clock()', 50);
}
if (document.layers ¦ ¦ document.all) window.onload = clock;
function setminute(m)
{
//document.write("<input type=text value='"+hr+":"+m+"'>");
h=m==60?hr+1+"":hr+"";
m=m==60?"00":m+"";
h=h.length==1?"0"+h:h;
m=m.length==1?"0"+m:m;
document.all.settime.innerHTML="<input type=text value='"