The implementation of JavaScript effects

Source: Internet
Author: User
Tags date array window root directory

Web page Production WEBJX article introduction: 1. Show different greetings in different time periods 〈script language=javascript〉〈!--var text=; day = new Date (); times = Day.gethours (); if ((time〉=0) (time〈7)) Text= night Owl, pay attention to the body Oh! if ((time〉= 7) (time〈12)) text= The sun is so bright today, what about your friend? If

1. Show different greetings in different time periods

〈script language= "Javascript" 〉〈!--var text= ""; Day = new Date ();   Time = Day.gethours (); if ((time〉=0) && (time〈7)) text= "Night Owl, pay attention to the body Oh!"   "If ((time〉= 7) && (time〈12)) text=" The sun is so bright today, what about your friend? if ((time〉=) && (time〈14)) text= "Lunch hour."   You want to keep sleep! " if ((time〉=14) && (time〈18)) text= "Wish you a pleasant afternoon work!"   "If ((time〉=) &&) text=" You are here again, do not talk to mm too long Oh! "   if ((time〉=) && (time〈24)) text= "You should rest!" document.write (text)//---〉〈/script〉

2. Slowly getting bigger window

〈script language= "Javascript" 〉〈!--var windowsheight=100 var windowswidth=100 var numx=5 function Openwindow (the Location) {temploc=thelocation if (!) ( Window.resizeto&&document.all) &&!   (Window.resizeto&&document.getelementbyid)) {window.open (thelocation) return} windowsize=window.open ("", "", "scrollbars") Windowsize.moveto (0,0) wind Owsize.resizeto (100,100) tenumxt ()} function Tenumxt () {if (windowsheight〉=screen.availheight-3) numx=0 win Dowsize.resizeby (5,NUMX) windowsheight+=5 windowswidth+=5 if (windowswidth〉=screen.width-5) {Windowsize.locat  Ion=temploc windowsheight=100 windowswidth=100 numx=5 return} settimeout ("Tenumxt ()", 50)}//--〉 〈/script〉〈p〉〈a href= "Javascript:openwindow (' http://www.ccjol.com ')" into the 〈/a〉

3. Change IE's address bar ie icon

We have to make a 16*16 icon (image file), Save as Index.ico. Upload this icon file to the root directory and add the following code to the home 〈head〉〈/head〉: 〈link REL = "shortcut icon" href= "Index.ico"

4. Let the Web page back at random

〈a href= "Javascript:history.go (x)" 〉x〈/a〉//replace X with the number you want to back up in the number of pages//put "-" into "+" for forward

5. Pop-up message box when pointing mouse

Add the following code between the 〈body〉〈/body〉: 〈a href onmouseover= "alert (' Pop-up info! ')" Shows the link text 〈/a〉

6. Click the right mouse button to eject the Add Favorites dialog box

Add the following code between the 〈body〉〈/body〉: 〈script language=javascript〉if (document.all) document.body.onmousedown=new Function ("If" (Ev ent.button==2event.button==3) window.external.addFavorite (' Your URL ', ' Your website name ') 〈/script〉

7. Random Transform background image (a special effect that can refresh mood)

Add the following code between the 〈head〉〈/head〉: 〈script language= "Javascript" 〉image = new Array (4);   Define image as the number of pictures of the array image [0] = ' tu0.gif '//Background image path 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〉

8. Translucent display effect of the table

〈head〉〈style〉.alpha{filter:alpha (OPACITY=50)}//50 represents 50% transparency 〈/style〉〈/head〉〈body〉〈table border= "1" width= "100"   height= "class=" "Alpha" bgcolor= "#F2A664" 〉〈tr〉〈td width= "100%" height= "62" 〉〈div align= "center" is cool, right!〈/div〉〈/td〉 〈/tr〉〈/table〉〈/body〉

Forum Discussion: http://bbs.websbook.com/viewthread.php?tid=1073&page=1&extra=page%3D1



Related Article

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.