JS implementation has time limit vanishing picture method _javascript Skill

Source: Internet
Author: User
Tags time limit visibility

The example of this article is about JS to achieve a time limit to disappear image method. Share to everyone for your reference. The implementation methods are as follows:

Copy Code code as follows:
<title> vanishing picture in the specified time </title>
<body>
<script language=javascript>
<!--Hide the script from old browsers--
1) make a 88*31 logo.
if (document.images)
var staticlogo=new Image (758,100)
2) Set the path of the logo.
Staticlogo.src= "/images/banner.gif"
3) The following is the connection of the logo representative.
var logolink= "http://wwwww.jb51.net/"
4) set the ALT attribute.
var alttext= "Code Home"
5 The following properties are set to 1 or 0 (1 is IE specific, so that the logo looming)
var fadeintoview=1
/* 6 finally set the logo display time, such as 12 seconds, the value of 0 is always displayed
*/
var visibleduration=5
function Regenerate () {
Window.location.reload ()
}
function Regenerate2 () {
if (document.layers)
settimeout ("Window.onresize=regenerate", 400)
}
var fadeset= '
if (Fadeintoview)
Fadeset= "Filter:alpha (opacity=0)"
if (document.all)
document.write (' <span id= ' logo "" style= "' +fadeset+ ';p osition:absolute;top:100;width: ' +staticlogo.width+ '; Height: ' +staticlogo.height+ ' "></span>")
function Bringintoview () {
if (logo.filters.alpha.opacity<=95)
Logo.filters.alpha.opacity+=5
else{
Clearinterval (Viewit)
if (visibleduration!=0)
settimeout ("logo.style.visibility= ' hidden '", visibleduration*1000)
}
}
function Createlogo () {
Staticimage=new Layer (100)
staticimage.left=-300
staticimage.top=120
Staticimage.document.write (' <a href= "' +logolink+ '" ></a> ')
Staticimage.document.close ()
Staticimage.visibility= "Show"
Regenerate2 ()
Staticitns ()
}
if (document.layers)
Window.onload=createlogo;
if (document.all) {
w=2
h=2
Logo.style.left=w
Logo.style.top=h
}
function Logoit () {
var w2=document.body.scrollleft+w
var h2=document.body.scrolltop+h
Logo.style.left=w2
Logo.style.top=h2
}
function Logoit2 () {
Staticimage.left=pagexoffset+2
Staticimage.top=pageyoffset+2
}
function Insertimage () {
Logo.innerhtml= ' <a href= "' +logolink+ '" ></a " > '
if (Fadeintoview)
Viewit=setinterval ("Bringintoview ()", 100)
else{
if (visibleduration!=0)
settimeout ("logo.style.visibility= ' hidden '", visibleduration*1000)
}
}
if (document.all) {
Window.onscroll=logoit
Window.onresize=new Function ("Window.location.reload ()")
Window.onload=insertimage
}
function Staticitns () {
SetInterval ("Logoit2 ()", 90)
if (visibleduration!=0)
settimeout ("staticimage.visibility= ' Hide '", visibleduration*1000)
}
-->
</SCRIPT>
</body>
<br>
<br>
<br>
<br>
<br>
<br> picture automatically disappears after 5 seconds.
<br>
<br>
<br>

I hope this article will help you with your JavaScript programming.

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.