You know that some special effect in web pages can be achieved only by HTML code. Follow the last article, we will learn how to limit the time of viewing the web page. Sometimes we need to do this. For example, when you want to build a website for the exam online, you need to limit the time because the students should hand on the test paper on time. This special effect need the help of the HTML codes and a div tag. Now let us learn how to achieve it by HTML codes.
Step1:
Open the web page you have built.
Sep2:
Set focus on the position that you want to add a Div tag. Then select the [insert]-[layout objects]-[Div tag] command. There will be a “insert div tag” dialog box appearing. In the ID textbox, input “a”. like the following picture showing:
Step3:
Change to the code view. Put the following codes into the section between <head> and </head>.
- <script language=javascript>
- Var yuan=9
- Function timelimit()
- {
- Var now=new Date()
- Var seconds=now.getSeconds()
- If(seconds++)
- {yuan- -}
- a.innerText=”you have “+yuan+” seconds to view”
- setTimeout(“timelimit()”,1000)
- if(yuan=0)
- self.close()
- }
- </script>
Maybe you have some confusion about them. Script means definite the content of program script. It is used in starting and ending to control the program. “var now” means start to time. a.innerText means the “you have “+yuan+” seconds to view” text will appear in the div tag. And self.close means the web page will close automatically on time. generally speaking, we use object. Action to express the action of objects. You can see it isn’t difficult.
Setp4:
Change to the spilt view. Add the code “onLoad=timelimit()” in to <body> sentence.
Setp5:
Save the document and preview it in the internet explorer. The effect is like this:
Now the special of limiting the time of viewing the web page is OK. In fact, this special effect is very easy. You just need to memorize the meanings of some codes such as timelimit, timeout, self close.
For help, advice, tips and tricks, challenges, feel free to visit our
or Submit your good resource to share.
Reminder: Unless stated otherwise, all resources published on this site are NOT for commercial use. To use any resource from this site for commercial purposes, please contact the author.


[...] article we learned how to limit the time of viewing the web page, which was very easy. following it, we will learn more about some special effect about web page [...]
[...] previous articles, we have learn that how to limit the time of viewing the web page and show different message in different time and make the web page roll automatically. These [...]
[...] have learned about the time special effects in web page. They are easy and you just need to learn about some codes. Today let us learn how to forbid the [...]