"JS Learning" MU class network 8-17 programming Exercise Web page return and jump

Source: Internet
Author: User

Programming exercises

Make a Jump Tip page:

Requirements:

1. If you open the page, if you do not do anything, then 5 seconds after the automatic jump to a new address, such as MU Class Web home page.

2. If you click the "Back" button, the previous page will be returned.

The code is as follows:

Note that 23 lines to use Window.location.href to specify the window.open words is opened in a new page

27 Line with timer setinterval to call the function can also be used settimeout but at this time, inside and outside the function to add that is commented out 25 lines

10 line hyperlink point must be javascript: Jump function

1<! DOCTYPE html>234<title> Browser Objects </title>5<meta http-equiv= "Content-type" content= "text/html; Charset=gkb "/>67<body>8<!--write a page layout first--9Ten<p><span id= "Second" >5</span> seconds back home <a href= "Javascript:goback ()" > Back </a></p> One    A    -   -<script type= "Text/javascript" > the   -    //Gets the element that displays the number of seconds, using the timer to change the number of seconds.  -    varNum=document.getelementbyid ("Second"). InnerHTML; - functionGoto () { +num--; -document.getElementById ("Second"). innerhtml=num; +     if(num==0) A     { atWindow.location.href= "http://www.baidu.com";//Window.Open's words are opened in a new window and need to be specified with location!  -     } -     //setTimeout ("Goto ()", +); - } -SetInterval ("Goto ()", 1000); -  in functionGoBack () { - Window.history.back (); to } +      -    //control the page jumps through the window's location and history object.  the    *</script> $</body>Panax Notoginseng

"JS Learning" MU class network 8-17 programming Exercise Web page return and jump

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.