最近在浏览网站的时候发现一个问题,当你将鼠标移动到FALSH等类型的控件上之后,就会出现“单击以激活并使用此控件”的提示,感觉非常讨厌。每次刷新都需要先点击进行激活。后来在网上查找相关内容,终于找到原因,今天整理出来和大家分享,希望对你有所帮助。
演示地址:http://www.pzwx.cn/flash/index.htm
也欢迎来我小站看看 http://www.pzwx.cn
因为现在Flash的显示方式和以前不同了,将鼠标放到FLASH等控件上面就会有一个虚线框,提示说“单击以激活并使用此控件”。也就是说页面刚打开的时候,页面上的Flash是没有被激活的,需要用户点击确认,这时Flash可以正常播放,但如果里面有交互性内容(比如:按钮)就不能直接点击,鼠标点击激活后交互性内容才可以使用。原因是你的系统在最近升级更新过了,并且安装了更新系统编号为KB912945的补丁。
这是微软为了避免与Eolas公司和加利福尼亚大学之间的专利侵权纠纷,而发布的一个IE非安全更新,这不是什么BUG 。
安装这个补丁以后,IE浏览器对ActiveX控件和Java程序的处理方式将有所改变,默认情况下不会主动激活,因此用户在访问Flash广告等网络内容时需要多点击一次鼠标,但非交互式控件不会改变,微软已经通知网站开发人员最好对他们的网页作出相应修改!
客户端的解决办法:在控制面板的"添加删除程序"中删除编号为"KB912945"的更新,如果列表中没有显示,需要在"添加删除程序"窗口右上角的“显示更新”前打√。
网站开发人员的应对办法:
一、下载后将压缩包内的“FLASH.js”文件放入站点任意文件夹中
二、在网页<head></head>之间插入以下代码
<!--修正FLASH正确显示代码开始-->
<script language="javascript" type="text/javascript" src="flash.js的相对路径"></script>
<!--修正FLASH正确显示代码结束-->
三、用下面java语句完全替换网页中“<object> ……〈/object>"(包括首尾标记)
<script language="javascript" type="text/javascript">
writeflashhtml("_swf=你的FLASH文件地址", "_width=你的FLASH文件宽度", "_height=你的FLASH文件高度" ,"_wmode=transparent");
</script>
点击下载该文件
网站是免费的,所以下载不能下,再把 falsh.js 源码贴出来。
//
代码开始
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
+=
"
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=
"
+
((_version)
?
_version:_default_version)
+
"
'
"
if
(_width) thtml
+=
"
width='
"
+
_width
+
"
'
"
if
(_height) thtml
+=
"
height='
"
+
_height
+
"
'
"
if
(_hspace) thtml
+=
"
hspace='
"
+
_hspace
+
"
'
"
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
+=
"
<param name='movie' value='
"
+
_swf
+
"
'>
"
if
(_quality) thtml
+=
"
<param name='quality' value='
"
+
_quality
+
"
'>
"
else
thtml
+=
"
<param name='quality' value ='
"
+
_default_quality
+
"
'>
"
if
(_loop) thtml
+=
"
<param name='loop' value='
"
+
_loop
+
"
'>
"
if
(_bgcolor) thtml
+=
"
<param name='bgcolor' value='
"
+
_bgcolor
+
"
'>
"
if
(_play) thtml
+=
"
<param name='play' value='
"
+
_play
+
"
'>
"
if
(_menu) thtml
+=
"
<param name='menu' value='
"
+
_menu
+
"
'>
"
else
thtml
+=
"
<param name='menu' value='
"
+
_default_menu
+
"
'>
"
if
(_scale) thtml
+=
"
<param name='scale' value='
"
+
_scale
+
"
'>
"
if
(_salign) thtml
+=
"
<param name='salign' value='
"
+
_salign
+
"
'>
"
if
(_wmode) thtml
+=
"
<param name='wmode' value='
"
+
_wmode
+
"
'>
"
if
(_base) thtml
+=
"
<param name='base' value='
"
+
_base
+
"
'>
"
if
(_flashvars) thtml
+=
"
<param name='flashvars' value='
"
+
_flashvars
+
"
'>
"
thtml
+=
"
<embed pluginspage='http://www.macromedia.com/go/getflashplayer'
"
if
(_width) thtml
+=
"
width='
"
+
_width
+
"
'
"
if
(_height) thtml
+=
"
height='
"
+
_height
+
"
'
"
if
(_hspace) thtml
+=
"
hspace='
"
+
_hspace
+
"
'
"
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
+=
"
></embed>
"
thtml
+=
"
</object>
"
document.write(thtml)
}
//
代码结束