天天看點

Jquery實作頁面定時跳轉

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<html>

<head>

<meta content="text/html; charset=utf-8" http-equiv="content-type" />

<title>跳轉頁面</title>

<mce:script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" mce_src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></mce:script>

<mce:script language="javascript"><!--

$(document).ready(function() {

function jump(count) {

window.settimeout(function(){

count--;

if(count > 0) {

$('#num').attr('innerhtml', count);

jump(count);

} else {

location.href="login.jsp";

}

}, 1000);

jump(3);

});

// --></mce:script>

</head>

<body>

<span style="color:red" mce_style="color:red">歡迎來到******!</span><br/>頁面将在3秒後跳轉...<br/>還剩<span id="num">3</span>秒

</body>

</html>

繼續閱讀