Home Web Front-end HTML Tutorial Organizing common special effects on web pages: Advanced

Organizing common special effects on web pages: Advanced

Dec 23, 2016 pm 02:54 PM


The author has accumulated many wonderful and practical web special effects over time. Almost all of these special effects are commonly used web page special effects. Now I will introduce these organized and modified special effects to you in three levels.

 Advanced Chapter

 1. Display different greetings in different time periods

 <Script Language="JavaScript">
 <!--
 var text=""; day = new Date( ); time = day.getHours( );
 if (( time> =0) && (time < 7 ))
  text="Night owls, please take care of yourself! "
 if (( time >= 7 ) && (time < 12))
  text="The sun is so bright today, you What about that friend? "
 if (( time >= 12) && (time < 14))
  text="It’s lunch break. "
 if (( time >=14) && (time < 18) )
  text="Wish you a happy afternoon at work! "
 if ((time >= 18) && (time <= 22))
  text="You are here again, please don't chat with MM for too long!"
 if ((time >= 22) && (time < 24))
  text="You should take a rest!"
 document.write(text)
 //--->
  /Script>

 2. Reflection effect in water

 <img id="reflect" src="../../your own picture file name" width="175" height="59">
 <script language="JavaScript">
 function f1()
 {
  setInterval("mp.filters.wave.phase+=10",100);
  }
 if (document.all)
 {
  document.write('<img id=mp src="'+ document.all.reflect.src+'"
 style="filter:wave(strength=3,freq=3,phase=0,lightstrength=30) blur() flipv()">')
 window.onload=f1
}
 </script>

 3. Slowly growing window

 <Script Language="JavaScript">
 <!--
 var Windowsheight=100
 var Windowswidth=100
 var numx=5
 function openwindow(thelocation){
 temploc=thelocation
 if
(!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById))
 {
  window.open(thelocation)
   return
  }
 windowsize=window.open("","","scrollbars")
windowsize.moveTo(0,0)
 windowsize.resizeTo(100,100)
 tenumxt()
 }
 function tenumxt(){
 if (Windowsheight>=screen.availHeight-3)
  numx=0
 windowsize.resizeBy(5, numx)
 Windowsheight+=5
 Windowswidth+=5
 if (Windowswidth>=screen.width-5)
 {
  Windowsize.location=temploc
  Windowsheight=100
  Windowswidth=100
  numx=5
  return
 }
 setTimeout(" tenumxt()",50)
  }
  //-->
 </script>
 <p><a href="javascript:openwindow('http://www.php.cn')">Enter</ a>

 4. Change the IE icon in the IE address bar

We need to first make a 16*16 icon (icon file) and save it as index.ico. Upload this icon file to the root directory and add the following code between <head></head> on the home page:

 <link REL = "Shortcut Icon" href="index.ico">

5. Let the web page go back at will

 <a href="javascript:history.go(-X)">X</a> //Replace +" Just to move forward

 6. An information box pops up when the mouse points to it

Add the following code between <body></body>:

  <a href onmouseover="alert('Pop-up information!')">Displayed link text </a>

 7. Click the right button of the mouse to pop up the add favorites dialog box

 Add the following code between <body></body>:

 <Script Language=JavaScript>
 if (document.all)
 document.body.onmousedown=new Function("if (event.button==2||event.button==3)
 window.external.addFavorite('your website','your website name)")
 </Script>

 8. Randomly transform the background image (a special effect that can refresh your mood)

Add the following code between <head></head>:

  <Script Language="JavaScript">
  image = new Array(4); / /Define image as an array of number of pictures
image [0] = 'tu0.gif' //The path of the background image
 image [1] = 'tu1.gif'
 image [2] = 'tu2.gif'
 image [3] = 'tu3.gif'
 image [4] = 'tu4.gif'
 number = Math.floor(Math.random() * image.length);
 document.write("<BODY BACKGROUND="+image[number]+">") ;
 </Script>

 9. Link to show the color as soon as the mouse is touched

Add the following code between <body></body>:

 <p onMouseMove="anniu()">If you dare to touch me, I will give you some color. ! </p>
 <Script Language = "VBScript">
 sub anniu
 document.fgColor=int(256*256*256*rnd)
 end sub
 </Script>

 10. A window falling from the sky with a phantom effect

 <head>
 <Script language="JavaScript">
  function move(x) {
 if(self.moveBy){
 self.moveBy (0,-800);
 for( i = x; i > 0; i--)
 {
 self.moveBy(0,3);
 }
 for(j = 200; j > 0; j--){ //If you think the window is shaking badly , just change 200 into single digits
 self.moveBy(0,j);
self.moveBy(j,0);
self.moveBy(0,-j);
self.moveBy(-j,0); 11. The translucent display effect of the table

Add the following code between <head></head>:

  <style>
  .alpha{filter: Alpha(Opacity=50)} //50 means 50% transparency
</style>

  Add the following code between <body></body>:
  <table border="1" width="100" height="62" class="alpha" bgcolor="#F2A664" >
 <tr>
 <td width="100%" height="62">
 <p align="center">It’s cool!</p>
 </td>
 </tr>
  </ table>

The above is the arrangement of commonly used special effects on web pages: advanced content. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles