手机
当前位置:查字典教程网 >网页设计 >XHTML >通过html为FLASH加链接的实现代码(div层)
通过html为FLASH加链接的实现代码(div层)
摘要:今天有个客户要投放广告,给的素材是flash的,虽然我们不太喜欢,但没办法,客户就喜欢flash,怕一些浏览器或软件屏蔽flash自带的链接...

今天有个客户要投放广告,给的素材是flash的,虽然我们不太喜欢,但没办法,客户就喜欢flash,怕一些浏览器或软件屏蔽flash自带的链接,需要我么通过html加一个链接,要不被阻止了效果不好。后果你懂的。

几年前帮别人维护的时候做过,后来好久不做了,感觉太生疏了,这里特别整理下,方便需要的朋友,希望大家多多支持查字典教程网。

下面是完整的代码,因为flash文件都比较大我们特别用iframe加载了广告:

XML/HTML Code复制内容到剪贴板 <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/> <title>flash加链接_查字典教程网专用</title> <styletype="text/css"> <!-- body{ position:relative; z-index:0; margin:0;padding:0 } body,td,th{ color:#333333; } *{margin:0;padding:0} img{border:0} #jb51{position:relative;width:300px;height:250px} #div1{ position:absolute; left:0; top:0; width:300px; height:250px;z-index:-1 } #div2{ position:absolute; left:0; top:0; width:300px; height:250px; z-index:99999; } #div2a:link{display:block;width:300px;height:250px} --> </style></head> <body> <divid="jb51"> <divid="div1"> <scripttype="text/javascript"> document.write('<objectclassid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"width="300"height="250">'); document.write('<paramname="movie"value="http://common.jb51.net/image/22cn_jb51net.swf"/>'); document.write('<paramname="quality"value="high"/><paramname="wmode"value="opaque"/>'); document.write('<embedsrc="http://common.jb51.net/image/22cn_jb51net.swf"quality="high"pluginspage="http://www.macromedia.com/go/getflashplayer"type="application/x-shockwave-flash"width="300"height="250"wmode="opaque"></embed>'); document.write('</object>'); </script> </div> <divid="div2"> <ahref="http://www.jb51.net"target="_blank"><imgsrc="http://common.jb51.net/image/touming.png"width="300"height="250"/></a> </div> </div> </body> </html> 现在广告管家都不好用了,百度管家停止其它物料,cnzz的被360屏蔽了,google的访问又慢。想进个后台也不容易。没办法只能放自己的服务器里了。

需要几点说明的:

<img src="http://common.jb51.net/image/touming.png" width="300" height="250" />这个里面的touming.png就是个1像素的透明png文件。不要图片的话ie下链接不对。

当然css样式是最重要的,先是position:relative,然后里面的才是position:absolute;

后来从网上看到别人提供的一个方法,通过button按钮实现的,就是不能新窗口打开。也顺便提供下吧。如果大家发现我们的这个也不好用希望能联系我们更新谢谢。

XML/HTML Code复制内容到剪贴板 <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/> <title>无标题文档</title> <styletype="text/css"> <!-- body{ position:relative; z-index:0; margin:0;padding:0 } body,td,th{ color:#333333; } *{margin:0;padding:0} img{border:0} #jb51{position:relative;width:300px;height:250px} #div1{ position:absolute; left:0; top:0; width:300px; height:250px;z-index:-1 } #div2{ position:absolute; left:0; top:0; width:300px; height:250px; z-index:99999; } --> </style> </head> <body> <buttonstyle="width:300;height:250;background:transparent;border:o;padding:0;cursor:hand"onclick="window.location.href='http://s.jb51.net'"> <objectclassid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"width="100%"height="100%"> <paramname="movie"value="http://common.jb51.net/image/22cn_jb51net.swf"> <paramname="quality"value="high"> <paramname="wmode"value="opaque"/> <embedsrc="http://common.jb51.net/image/22cn_jb51net.swf"width="300"height="250"quality="high"pluginspage="http://www.macromedia.com/go/getflashplayer"type="application/x-shockwave-flash"align="middle"wmode="opaque"> </embed> </object> </button> </body> </html> 好了,这篇文章就介绍到这,基本上能凑合用了。欢迎留言评论。查字典教程网原创。

【通过html为FLASH加链接的实现代码(div层)】相关文章:

html中锚点的应用

通过iframe实现在body中放frameset

在HTML里为FLASH加链接并兼容各大浏览器的方法

几个老式播放器的嵌入代码

html中br和br/的区别介绍

shtml与html的区别说明

浅析html 空格代码

html插入链接的实现方法

html的基本使用包括链接、样式表、span和div等等

html中iframe控制父页面刷新实现思路及代码

精品推荐
分类导航