通過(guò)html為FLASH加鏈接的實(shí)現(xiàn)代碼(div層)

字號(hào):


    今天有個(gè)客戶要投放廣告,給的素材是flash的,雖然我們不太喜歡,但沒(méi)辦法,客戶就喜歡flash,怕一些瀏覽器或軟件屏蔽flash自帶的鏈接,需要我么通過(guò)html加一個(gè)鏈接,要不被阻止了效果不好。后果你懂的。
    幾年前幫別人維護(hù)的時(shí)候做過(guò),后來(lái)好久不做了,感覺(jué)太生疏了,這里特別整理下,方便需要的朋友,希望大家多多支持腳本之家。
    下面是完整的代碼,因?yàn)閒lash文件都比較大我們特別用iframe加載了廣告:
    XML/HTML Code復(fù)制內(nèi)容到剪貼板
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>flash加鏈接_腳本之家專用</title>
    <style type="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;
    }
    #div2 a:link{ display:block; width:300px; height:250px}
    -->
    </style></head>
    <body>
    <div id="jb51">
    <div id="div1">
    <script type="text/javascript">
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" width="300" height="250">');
    document.write('<param name="movie" value="" />');
    document.write('<param name="quality" value="high" /><param name="wmode" value="opaque" />');
    document.write('<embed src="" quality="high" pluginspage="" type="application/x-shockwave-flash" width="300" height="250" wmode="opaque"></embed>');
    document.write('</object>');
    </script>
    </div>
    <div id="div2">
    <a href="" target="_blank"><img src="" width="300" height="250" /></a>
    </div>
    </div>
    </body>
    </html>
    現(xiàn)在廣告管家都不好用了,百度管家停止其它物料,cnzz的被360屏蔽了,google的訪問(wèn)又慢。想進(jìn)個(gè)后臺(tái)也不容易。沒(méi)辦法只能放自己的服務(wù)器里了。
    需要幾點(diǎn)說(shuō)明的:
    <img src="" width="300" height="250" />這個(gè)里面的touming.png就是個(gè)1像素的透明png文件。不要圖片的話ie下鏈接不對(duì)。
    當(dāng)然css樣式是最重要的,先是position:relative,然后里面的才是position:absolute;
    后來(lái)從網(wǎng)上看到別人提供的一個(gè)方法,通過(guò)button按鈕實(shí)現(xiàn)的,就是不能新窗口打開(kāi)。也順便提供下吧。如果大家發(fā)現(xiàn)我們的這個(gè)也不好用希望能聯(lián)系我們更新謝謝。
    XML/HTML Code復(fù)制內(nèi)容到剪貼板
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>無(wú)標(biāo)題文檔</title>
    <style type="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>
    <button onclick="window.location.>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="" height="100%">
    <param name="movie" value="">
    <param name="quality" value="high">
    <param name="wmode" value="opaque" />
    <embed src="" width="300" height="250" quality="high" pluginspage="" type="application/x-shockwave-flash" wmode="opaque">
    </embed>
    </object>
    </button>
    </body>
    </html>