In many cases, you need to click activate in flash. However, in general, you do not need to activate flash directly in the new version, but there are a lot of code. The following method is a function. In fact, there are a lot of code, but the idea is good, let's take a look.
The Code is as follows:
Step 1: Write a JS script file flash. js
Program code:
Function writeFlashHTML (arg)
{
Var parm = []
Var _ default_version = "8, 0, 24, 0 ";
Var _ default_quality = "high ";
Var _ default_align = "middle ";
Var _ default_menu = "false ";
For (I = 0; I <arguments. length; I ++)
{
Parm [I] = arguments [I]. split (''). join (''). split ('= ')
For (var j = parm [I]. length-1; j> 1; j --){
Parm [I] [J-1] + = "=" + parm [I]. pop ();
}
Switch (parm [I] [0])
{
Case '_ version': var _ version = parm [I] [1]; break;
Case '_ swf': var _ swf = parm [I] [1]; break;
Case '_ base': var _ base = parm [I] [1]; break;
Case '_ quality': var _ quality = parm [I] [1]; break;
Case '_ loop': var _ loop = parm [I] [1]; break;
Case '_ bgcolor': var _ bgcolor = parm [I] [1]; break;
Case '_ wmode': var _ wmode = parm [I] [1]; break;
Case '_ play': var _ play = parm [I] [1]; break;
Case '_ menu': var _ menu = parm [I] [1]; break;
Case '_ scale': var _ scale = parm [I] [1]; break;
Case '_ salign': var _ salign = parm [I] [1]; break;
Case '_ height': var _ height = parm [I] [1]; break;
Case '_ width': var _ width = parm [I] [1]; break;
Case '_ hspace': var _ hspace = parm [I] [1]; break;
Case '_ vspace': var _ vspace = parm [I] [1]; break;
Case '_ align': var _ align = parm [I] [1]; break;
Case '_ class': var _ class = parm [I] [1]; break;
Case '_ id': var _ id = parm [I] [1]; break;
Case '_ name': var _ name = parm [I] [1]; break;
Case '_ style': var _ style = parm [I] [1]; break;
Case '_ declare': var _ declare = parm [I] [1]; break;
Case '_ flashvars': var _ flashvars = parm [I] [1]; break;
Default :;
}
}
Var thtml = ""
Thtml + ="If (_ width) thtml + = "width = '" + _ width + "'"
If (_ height) thtml + = "height = '" + _ height + "'"
If (_ heat Ace) thtml + = "heat ACE = '" + _ heat ACE + "'"
If (_ vspace) thtml + = "vspace = '" + _ vspace + "'"
If (_ align) thtml + = "align = '" + _ align + "'"
Else thtml + = "align = '" + _ default_align + "'"
If (_ class) thtml + = "class = '" + _ class + "'"
If (_ id) thtml + = "id = '" + _ id + "'"
If (_ name) thtml + = "name = '" + _ name + "'"
If (_ style) thtml + = "style = '" + _ style + "'"
If (_ declare) thtml + = "" + _ declare
Thtml + = ">"
If (_ swf) thtml + =""
If (_ quality) thtml + =""
Else thtml + =""
If (_ loop) thtml + =""
If (_ bgcolor) thtml + =""
If (_ play) thtml + =""
If (_ menu) thtml + =""
Else thtml + =""
If (_ scale) thtml + =""
If (_ salign) thtml + =""
If (_ wmode) thtml + =""
If (_ base) thtml + =""
If (_ flashvars) thtml + =""
Thtml + ="If (_ width) thtml + = "width = '" + _ width + "'"
If (_ height) thtml + = "height = '" + _ height + "'"
If (_ heat Ace) thtml + = "heat ACE = '" + _ heat ACE + "'"
If (_ vspace) thtml + = "vspace = '" + _ vspace + "'"
If (_ align) thtml + = "align = '" + _ align + "'"
Else thtml + = "align = '" + _ default_align + "'"
If (_ class) thtml + = "class = '" + _ class + "'"
If (_ id) thtml + = "id = '" + _ id + "'"
If (_ name) thtml + = "name = '" + _ name + "'"
If (_ style) thtml + = "style = '" + _ style + "'"
Thtml + = "type = 'application/x-shockwave-flash '"
If (_ declare) thtml + = "" + _ declare
If (_ swf) thtml + = "src = '" + _ swf + "'"
If (_ quality) thtml + = "quality = '" + _ quality + "'"
Else thtml + = "quality = '" + _ default_quality + "'"
If (_ loop) thtml + = "loop = '" + _ loop + "'"
If (_ bgcolor) thtml + = "bgcolor = '" + _ bgcolor + "'"
If (_ play) thtml + = "play = '" + _ play + "'"
If (_ menu) thtml + = "menu = '" + _ menu + "'"
Else thtml + = "menu = '" + _ default_menu + "'"
If (_ scale) thtml + = "scale = '" + _ scale + "'"
If (_ salign) thtml + = "salign = '" + _ salign + "'"
If (_ wmode) thtml + = "wmode = '" + _ wmode + "'"
If (_ base) thtml + = "base = '" + _ base + "'"
If (_ flashvars) thtml + = "flashvars = '" + _ flashvars + "'"
Thtml + = ">"
Thtml + =""
Document. write (thtml)
}
Step 2: reference this JS file to the corresponding page:
The Code is as follows: