但是對于flash或者下拉框,是容易被遮擋的。
1、flash的解決:
??? <!--1.設置FLASH為底層-->
??? <div style="z-index:-1">
??? <!--2.必須把FLASH設置為透明-->
??? <param name="wmode" value="transparent">
2、下拉框的解決:
??? 因為下拉框的index是最高的,怎么調整都沒有用。
??? 所以,浮動層里面要增加一個iframe,里面再src近來一個新頁面,這個頁面就是廣告頁面。
???
?1?<!--?浮云?-->
?2?<div?id="fuyun"?style="Z-INDEX:?99999999999;?LEFT:?4px;?WIDTH:?100px;?POSITION:?absolute;?TOP:?372px;?HEIGHT:?100px">?
?3?<p?align="center">
?4?<iframe?height="80"?width="80"?frameborder="0"?scrolling="no"?hspace="0"?vspace="0"?style="padding:0;?margin:0"?src="ad_kfc/fy_kfc.html">
?5?</iframe>
?6?</p>
?7?</div>
?8?<script?language="JavaScript"?src="js/fy.js"></script>
?9?<SCRIPT?LANGUAGE="JavaScript">
10?<!--
11?????start();
12?//-->
13?</SCRIPT>
?2?<div?id="fuyun"?style="Z-INDEX:?99999999999;?LEFT:?4px;?WIDTH:?100px;?POSITION:?absolute;?TOP:?372px;?HEIGHT:?100px">?
?3?<p?align="center">
?4?<iframe?height="80"?width="80"?frameborder="0"?scrolling="no"?hspace="0"?vspace="0"?style="padding:0;?margin:0"?src="ad_kfc/fy_kfc.html">
?5?</iframe>
?6?</p>
?7?</div>
?8?<script?language="JavaScript"?src="js/fy.js"></script>
?9?<SCRIPT?LANGUAGE="JavaScript">
10?<!--
11?????start();
12?//-->
13?</SCRIPT>
其中這個src頁面代碼如下:
1?<html>
2?<head>
3?<title>?fy?kfc?</title>
4?</head>
5?<body?style="padding:0;?margin:0">
6?<a?href="/public/enterprise.do?id=29838"?target="_blank"><img?src="kfc.gif"?width="80"?height="80"?border=0></a>
7?</body>
8?</html>
9?
2?<head>
3?<title>?fy?kfc?</title>
4?</head>
5?<body?style="padding:0;?margin:0">
6?<a?href="/public/enterprise.do?id=29838"?target="_blank"><img?src="kfc.gif"?width="80"?height="80"?border=0></a>
7?</body>
8?</html>
9?
還是把浮動窗口的js代碼貼上來,原來網上找的代碼,參數名字過于簡單,怕多個js一起調用時會重名。自己改了一下的
?1?var?fuyun?=?document.getElementById("fuyun");
?2?var?fy_xPos?=?20;
?3?var?fy_yPos?=?document.body.clientHeight;
?4?var?fy_step?=?1;
?5?var?fy_delay?=?30;?
?6?var?fy_height?=?0;
?7?var?fy_Hoffset?=?0;
?8?var?fy_Woffset?=?0;
?9?var?fy_yon?=?0;
10?var?fy_xon?=?0;
11?var?fy_pause?=?true;
12?var?interval;
13?fuyun.style.top?=?fy_yPos;
14?function?changePos()?{
15?fy_width?=?document.body.clientWidth;
16?fy_height?=?document.body.clientHeight;
17?fy_Hoffset?=?fuyun.offsetHeight;
18?fy_Woffset?=?fuyun.offsetWidth;
19?fuyun.style.left?=?fy_xPos?+?document.body.scrollLeft;
20?fuyun.style.top?=?fy_yPos?+?document.body.scrollTop;
21?if?(fy_yon)?{
22?fy_yPos?=?fy_yPos?+?fy_step;
23?}
24?else?{
25?fy_yPos?=?fy_yPos?-?fy_step;
26?}
27?if?(fy_yPos?<?0)?{
28?fy_yon?=?1;
29?fy_yPos?=?0;
30?}
31?if?(fy_yPos?>=?(fy_height?-?fy_Hoffset))?{
32?fy_yon?=?0;
33?fy_yPos?=?(fy_height?-?fy_Hoffset);
34?}
35?if?(fy_xon)?{
36?fy_xPos?=?fy_xPos?+?fy_step;
37?}
38?else?{
39?fy_xPos?=?fy_xPos?-?fy_step;
40?}
41?if?(fy_xPos?<?0)?{
42?fy_xon?=?1;
43?fy_xPos?=?0;
44?}
45?if?(fy_xPos?>=?(fy_width?-?fy_Woffset))?{
46?fy_xon?=?0;
47?fy_xPos?=?(fy_width?-?fy_Woffset);
48?}
49?}
50?function?start()?{
51?fuyun.visibility?=?"visible";
52?interval?=?setInterval('changePos()',?fy_delay);
53?
54?}
55?function?fy_pause_resume()?{
56?if(fy_pause)?{
57?clearInterval(interval);
58?fy_pause?=?false;
59?}
60?else?{
61?interval?=?setInterval('changePos()',fy_delay);
62?fy_pause?=?true;
63?}
64?}
?2?var?fy_xPos?=?20;
?3?var?fy_yPos?=?document.body.clientHeight;
?4?var?fy_step?=?1;
?5?var?fy_delay?=?30;?
?6?var?fy_height?=?0;
?7?var?fy_Hoffset?=?0;
?8?var?fy_Woffset?=?0;
?9?var?fy_yon?=?0;
10?var?fy_xon?=?0;
11?var?fy_pause?=?true;
12?var?interval;
13?fuyun.style.top?=?fy_yPos;
14?function?changePos()?{
15?fy_width?=?document.body.clientWidth;
16?fy_height?=?document.body.clientHeight;
17?fy_Hoffset?=?fuyun.offsetHeight;
18?fy_Woffset?=?fuyun.offsetWidth;
19?fuyun.style.left?=?fy_xPos?+?document.body.scrollLeft;
20?fuyun.style.top?=?fy_yPos?+?document.body.scrollTop;
21?if?(fy_yon)?{
22?fy_yPos?=?fy_yPos?+?fy_step;
23?}
24?else?{
25?fy_yPos?=?fy_yPos?-?fy_step;
26?}
27?if?(fy_yPos?<?0)?{
28?fy_yon?=?1;
29?fy_yPos?=?0;
30?}
31?if?(fy_yPos?>=?(fy_height?-?fy_Hoffset))?{
32?fy_yon?=?0;
33?fy_yPos?=?(fy_height?-?fy_Hoffset);
34?}
35?if?(fy_xon)?{
36?fy_xPos?=?fy_xPos?+?fy_step;
37?}
38?else?{
39?fy_xPos?=?fy_xPos?-?fy_step;
40?}
41?if?(fy_xPos?<?0)?{
42?fy_xon?=?1;
43?fy_xPos?=?0;
44?}
45?if?(fy_xPos?>=?(fy_width?-?fy_Woffset))?{
46?fy_xon?=?0;
47?fy_xPos?=?(fy_width?-?fy_Woffset);
48?}
49?}
50?function?start()?{
51?fuyun.visibility?=?"visible";
52?interval?=?setInterval('changePos()',?fy_delay);
53?
54?}
55?function?fy_pause_resume()?{
56?if(fy_pause)?{
57?clearInterval(interval);
58?fy_pause?=?false;
59?}
60?else?{
61?interval?=?setInterval('changePos()',fy_delay);
62?fy_pause?=?true;
63?}
64?}
不提倡使用浮動廣告,現在多半都是懸浮廣告了。只是客戶指定要,而且還要不被遮擋,在多人的幫助下,終于解決了這個問題。
大家可以到 http://www.jobhn.cn 網站上看看實際的效果。