Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize scheduled Jump Page by javascript

Shulou Source: shulou.com Published: 2022-05-31 11:56:14 10月31日 Update

This article mainly explains "javascript how to achieve timed jump page," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "javascript how to achieve timed jump page"!

In javascript, you can use setTimeout() with the href attribute of the location object to implement the timed jump page function, with the syntax format "setTimeout("_javascript:location.href= jump page address ", milliseconds);".

Operating environment of this tutorial: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.

javascript implementation timing jump page

//5 seconds later jump to setInterval("myInterval()",5000);//1000 is 1 second function myInterval(){ _window.location.href ='/crm/php/mail/editmail.php ';}

Optimization code:

//jump setTimeout("_javascript:location.href='https://www.example.com'", 5000) after five seconds; www.php.cn

Description:

The setTimeout() method is used to invoke a function or evaluate an expression after a specified number of milliseconds. The syntax format is as follows:

setTimeout(code,millisec) Parameter Description code Required. The string of JavaScript code to execute after the function to call. Millisec is required. Number of milliseconds to wait before executing code.

The_window.location.href property is a readable and writable string that sets or returns the full URL of the currently displayed document.

Therefore, we can make the browser read and display the contents of the new URL by setting a new URL for this attribute.

syntax

location.href=URL Here, I believe everyone has a deeper understanding of "javascript how to achieve timed jump pages", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Page code content properties syntax function method format learning practical deeper interest function parameter can be passed address character string practicality actual Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft NVidia OPPO Reno Redmi