Javascript: compatible with IE, FireFox, and Chrome

Source: Internet
Author: User

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> flash load progress </title>
<Script>
</Script>
</Head>
<Body>
<Div> <span class = "intro"> download progress: </span>
<Div class = "barborder">
<Div class = "bar" id = "loadpercent"> </div>
</Div>
</Div>


<Object classid = "clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width = "700px" height = "350" id = "ieGame">
<Param name = "movie" value = "http://360.kuaiwan.com/games/6/6C36DF75DE92FF1148592FF0F093E5C00DA17A91.swf">
<Param name = "quality" value = "high"> <param name = "wmode" value = "transparent">
<Embed
Wmode = "transparent"
Src = "http://360.kuaiwan.com/games/6/6C36DF75DE92FF1148592FF0F093E5C00DA17A91.swf"
Quality = "high"
Type = "application/x-shockwave-flash"
Pluginspage = "http://www.macromedia.com/go/getflashplayer"
Width = "700px" height = "350px" id = "fireFoxGame" name = "fireFoxGame">
</Embed>
</Object>
</Body>
</Html>


<Script>
 
If (window. navigator. userAgent. indexOf ("Firefox")> = 1 | window. navigator. userAgent. indexOf ("AppleWebKit")> = 1) {/* is fireFox */
Var progress = self. setInterval (function (){
Var progress = document. fireFoxGame;
Document. getElementById ("loadpercent"). innerHTML = "" + progress. PercentLoaded ();
}, 5 );
// Document. getElementById ("loadpercent"). innerHTML = "" + Math. abs (progress) + "% ";
} Else {/* is IE */
RefreshProgress ();
}
Function show () {// hide the AD layer and display the FLASH Layer
Document. getElementById ("showAD"). style. display = 'none ';
// Document. getElementById ("showSWF"). style. display = 'block ';
}
 
Function refreshProgress () {// refresh the progress bar function
Var bar = document. getElementById ("loadpercent ");
Var movie = document. getElementById ("ieGame ");
Var nPercentLoaded = Math. abs (movie. PercentLoaded ());
Bar. innerHTML = nPercentLoaded + "% ";
If (nPercentLoaded = 100 ){
Bar. innerHTML = "Game download is complete ";
} Else {
SetTimeout ('refreshprogress () ', 0 );
}
}
</Script>

Author: "brian. netmad's blog"
 

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.