In 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 special effects use date function, stroller function. Now we learn how to forbid the page to minimize and close the web page after click a link. You always see these words in different web page—-“click here to close this page”. Yes, it is achieved by HTML codes. Sometimes, you may don’t want to let the viewers minimize the web page. In this case, we still need the help of the HTML codes. Now let us learn how to achieve these effects.
Section1 achieve the effect of closing the webpage after clicking a link
It mainly uses the window. Close function.
Step1
Open a web page.
Step2
Put the codes into the section between <body> and </body>.
- <script language=JavaScript>
- function closewin()
- {
- window.close();
- return;
- }
- </script>
You also can set the link “javascript: closewin ()” to the text, like the pic1showing:
Step3
Save it and preview. After clicking the “close the page”, you can see the window closed.
Section2 forbid the web page to minimize
It mainly use onblur=’self. focus();’ function.
Step1
Open a web page.
Step2
Modify the <body> sentence like this:
- <body onblur=’self. Focus () ;’>
- </body>
Setp3
Go back to the design view and save the document, press F12 to preview in the internet explorer. You can see that the minimize button doesn’t work at all.
In the two special effects, we use window. Close and self. Focus function. In addition, if you want to the page to show full screen, you just need to use the “fullscreen=yes” function. You just need to master a few codes, and you can make the splendid web page.

