项目中,曾有一个需求,给flash广告添加链接,跳转到另一个网站。于是直接在html的flash object前面加上<a href="url">,发现链接不起作用。
解决方案:
以下各种尝试的解决方案,方式三为最佳实践!
【方式一】在flash外围添加 <a href=...> 标签
【效 果】无效!
<html> <head> <title>给flash添加链接</title> </head> <body> <h3>方式一:在flash外围添加 a href=... 标签</h3> <div> <!--此处添加链接--> <a href="url" target="_blank" style="text-decoration:none"> <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="192" height="136"> <param name="movie" value="fla/xxx.swf"> <!--此处添加flash--> <param name="quality" value="high"> <!--此处添加flash--> <embed src="fla/xxx.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="192" height="136"></embed> </object> </a> </div> </body> </html>
【方式二】用一个透明的大button包在flash的最外层,或是用一个层盖住flash,然后定义button的onclick事件
【效 果】有效,但用户最关心的SEO作用消失,因为该跳转由JS实现!
<html> <head> <title>给flash添加链接</title> </head> <body> <h3>方式二:用一个透明的大button包在flash的最外层,或是用一个层盖住flash,然后定义button的onclick事件</h3> <div> <button style="width:192;height:136;background:transparent;border:0; margin:0; padding:0;cursor:hand" onclick="window.open('url')"><!--此处添加链接--> <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="192" height="136"> <param name="movie" value="fla/xxx.swf"> <!--此处添加flash--> <param name="quality" value="high"> <param name="wmode" value="transparent"> <!--此处添加flash--> <embed src="fla/xxx.swf" width="192" height="136" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed> </object> </button> </div> </body> </html>
【方式三】用一个透明图链接盖住flash,再利用div的zindex属性将flash放在zindex=-1的层,同时设置wmode="transparent"
【效 果】有效!满足各方需求!
<html> <head> <title>给flash添加链接</title> </head> <body> <h3>方式三:用一个透明图链接盖住flash,再利用div的zindex属性将flash放在zindex=-1的层,同时设置wmode="transparent"</h3> <div style="z-index:-1"> <!-- 设置z-index属性为-1 --> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="192" height="136"> <param name="movie" value="fla/xxx.swf" /> <!--此处添加flash--> <param name="quality" value="high" /> <param name="wmode" value="opaque" /> <!--此处添加flash--> <embed src="fla/xxx.swf" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="192" height="136"></embed> </object> </div> <div id="masker" style="cursor: hand; margin-top:-136px; width:192px; height:136px; z-index:1; visibility: visible; border:0;"> <!--此处添加链接--> <a href="url" target="_blank" style="text-decoration:none;"> <!--此处添加遮盖flash的透明图片--> <img src="images/flashMasker.gif" width="192" height="136" border="0" /> </a> </div> </body> </html>
Internet Affiliate Marketing Tips And Tr
What You Should Know About Soccer Active
Basic Guidelines To Help You Build Muscl
Straightforward Actions You Can Take Whe
What You Must Learn About Football Takin
Nawarstwienie atrakcji poszukasz na stro
Some Helpful Suggestions When Dealing Wi