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.

clip_image002

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>.

  1. <script language=JavaScript>
  2. function closewin() 
  3. {
  4. window.close();
  5. return;
  6. }
  7. </script>

You also can set the link “javascript: closewin ()” to the text, like the pic1showing:

clip_image004

Step3

Save it and preview. After clicking the “close the page”, you can see the window closed.

clip_image006

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:

  1. <body onblur=’self. Focus () ;’>
  2. </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.

Related Posts