Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize scheduled Jump Page in javascript

Shulou Source: shulou.com Published: 2022-05-31 10:35:31 09月23日 Update

Today Xiaobian to share with you how to achieve timed jump page in javascript related knowledge points, detailed content, clear logic, I believe most people are still too familiar with this knowledge, so share this article for everyone to refer to, I hope you read this article after harvest, let's learn about it together.

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 Above is "How to realize timed jump page in javascript" All the contents of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Pages knowledge articles code content attributes syntax functions formats different large functions parameters can pass address most characters strings objects that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Huawei vpn NVidia Linux