温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

小代码   html 自己网页倒计时跳转

发布时间:2020-08-01 10:47:03 来源:网络 阅读:605 作者:wzdouban 栏目:开发技术
<!--- 界面效果做到了 但函数还是在执行中--->
<HTML>
<HEAD>
  <script language="javascript">
var secs = 20; //倒计时的秒数 
var URL ="http://mzsts.host3v.com" ;
function Load(){
for(var i=secs;i>=0;i--) 
  { 
   window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000); 
  } 
}
function doUpdate(num) 
{ 
if(secs>0)
  {document.getElementById('ShowDiv').innerHTML = '将在'+num+'秒后自动跳转到主页' ;
   if(num == 0) { window.location =URL; }
  }
}

function timefun(){
secs =-1;
}



</script>
</HEAD>
 

<body onload="Load()" >   
<canvas id="myCanvas" width="50px" height="50px" >
 
</canvas>
<canvas id="myCanvas2" width="180px" height="50px" >
  
</canvas>
 
<script type="text/javascript">
  <!-- 1 -->
var canvas = document.getElementById("myCanvas");
if(canvas.getContext){   
var ctx = canvas.getContext("2d");    
    ctx.beginPath(); 
    ctx.strokeStyle = "blue";
    var circle = { x : 10,  y : 40,   r : 10  };
ctx.arc(circle.x, circle.y, circle.r, -Math.PI*3/ 4, Math.PI / 2, false);   ctx.stroke();
}
     <!-- 2 -->
var canvas = document.getElementById("myCanvas");
if(canvas.getContext){   
    var ctx = canvas.getContext("2d");    
    ctx.beginPath(); 
    ctx.strokeStyle = "blue";
    var circle = { x : 25,  y : 26,   r : 10  };ctx.arc(circle.x, circle.y, circle.r, -Math.PI/2, Math.PI/4, true);      ctx.stroke();
}
      <!-- 3-->
var canvas = document.getElementById("myCanvas");
if(canvas.getContext){   
    var ctx = canvas.getContext("2d");    
    ctx.beginPath(); 
    ctx.strokeStyle = "red";
    var circle = { x : 30,  y : 35,   r : 10  };
ctx.arc(circle.x, circle.y, circle.r, -Math.PI*3/ 4, Math.PI / 2, false);   ctx.stroke();
}
     <!-- 4 -->
var canvas = document.getElementById("myCanvas");
if(canvas.getContext){   
    var ctx = canvas.getContext("2d");    
    ctx.beginPath(); 
    ctx.strokeStyle = "red";
    var circle = { x :45,  y : 23,   r : 10  };ctx.arc(circle.x, circle.y, circle.r, -Math.PI/2, Math.PI/4, true);      ctx.stroke();
}
var canvas = document.getElementById("myCanvas2");
if(canvas.getContext){   
    var ctx = canvas.getContext("2d"); 
    ctx.font = "10px Courier New"; 
    ctx.fillStyle = "blue"; 
    ctx.fillText("文洲 的个人主页,彼岸", 10, 20);
    ctx.fillText("http://mzsts.host3v.com", 10, 40);
}
</script> 


    
<div id="ShowDiv">  </div>
 </br>  
 <button onclick="timefun()">点击延时</button>  
 <button onclick="window.open('http://mzsts.host3v.com')">直接跳转</button>  
 
 </br> </br>
<textarea  rows="5" cols="40">
<body onload="Load('http://mzsts.host3v.com')">   
<body onload="Load('http:www.baidu.com')">  
</textarea>
</body>
 
</HTML>


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI