Javascript USES the timing function to jump to a page

  • 2020-03-30 01:04:07
  • OfStack

Sometimes we jump to a page to finish the task and then return to the original page, which can be seen on many download sites, in order to retain users.

This timing function is easy to implement in javascript.

Window. setTimeout(code,time) // time set by code time executed by code
 
<!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"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>javascript Automatic jump </title> 
<script type="text/javascript"> 
function redrect() 
{ 
window.location = "1.html"; 
} 
window.setTimeout(redrect,3000);//The jump function
</script> 
</head> 
<body > 
<h4 style="color:#F00"> This is the jump page ....</h4> 
</body> 
</html> 

Related articles: