Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize scheduled Jump Page by javascript

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report