Because many mobile terminals do not support Flash, many colorful Flash effects can be achieved. If you can determine the type of the Web page (PC or mobile terminal) You want to visit ). You can find a solution to this problem!
For mobile phones, we use the. gif replacement for flash (.swf suffix) animation, and the PC side will not change. This is perfect!
As shown below, the flashChecker () function is used to detect access types.
Copy codeThe Code is as follows:
<Script language = "javascript" type = "text/javascript">
/*
* Used to detect whether a PC or a mobile terminal is used
* Return value: flashChecker (). f = true PC terminal
* Vice versa: Mobile Terminal
*/
Function flashChecker (){
Var hasFlash = 0;
Var flashVersion = 0;
Var isIE =/* @ cc_on! @ */0;
If (isIE ){
Var swf = new ActiveXObject ("ShockwaveFlash. ShockwaveFlash ");
If (swf ){
HasFlash = 1;
VSwf = swf. GetVariable ("$ version ");
FlashVersion = parseInt (VSwf. split ("") [1]. split (",") [0]);
}
}
Else {
If (navigator. plugins & navigator. plugins. length> 0 ){
Var swf = navigator. plugins ["Shockwave Flash"];
If (swf ){
HasFlash = 1;
Var words = swf. description. split ("");
For (var I = 0; I <words. length; ++ I ){
If (isNaN (parseInt (words [I]) {
Continue;
}
FlashVersion = parseInt (words [I]);
}
}
}
}
Return {
F: hasFlash, v: flashVersion
};
}
</Script>
Expansion:
Copy codeThe Code is as follows:
<Script language = "javascript" type = "text/javascript">
/*
* Output swf animation based on parameters
* Url: Click the jump address after the swf animation.
* SwfLink: *. swf clip address
*/
Function GetSwfHtml (url, swfLink ){
Html = "<a style = 'position: absolute; top: 0; left: 0; bottom: 0; right: 0; display: block;" +
"Width: 100%; height: expression (this. parentNode. scrollHeight); filter: alpha (opacity = 0);" +
"Opacity: 0; background: # FFF; 'href = '" + url + "'target =' _ blank '>" +
"</A>" +
"<Object width = '000000' height = '55' align = 'middle'>" +
"<Param name = 'allowScriptAccess' value = 'never '/>" +
"<Param name = 'quality' value = 'high'/>" +
"<Param name = 'wmode' value = 'transparent '/>" +
"<Param name = 'movie 'value ='" + swfLink + "'/>" +
"<Embed wmode = 'transparent 'src = '" + swfLink + "'quality = 'high'" +
"Width = '000000' height = '55' align = 'middle' allowscriptaccess = 'never 'Type = 'application/x-shockwave-flash'" +
"Pluginspage = '" + url + "'/>" +
"</Object> ";
Return html;
}
</Script>