HTML網頁兩邊的廣告圖片怎麼放上去的?
- 2022-07-19
<!——把下面程式碼加到
與之間——><!——
var showad = true;
var Toppx = 60;//上端位置
var AdDivW = 100;//寬度
var AdDivH = 300;//高度
var PageWidth = 700;//頁面多少寬度象素下正好不出現左右捲軸
var MinScreenW = 1024;//顯示廣告的最小螢幕寬度象素
var ClosebuttonHtml = ‘
’var AdContentHtml = ‘’;
document。write (‘
var ClosebuttonHtml = ‘
’var AdContentHtml = ‘’;
document。write (‘
function scall(){
if(!showad){return;}
if (window。screen。width alert(“臨時提示:\n\n顯示器解析度寬度小於”+MinScreenW+“,不顯示廣告”); showad = false; document。getElementById(“Javascript。LeftDiv”)。style。display=“none”; document。getElementById(“Javascript。RightDiv”)。style。display=“none”; return; } var Borderpx = ((window。screen。width-PageWidth)/2-AdDivW)/2; document。getElementById(“Javascript。LeftDiv”)。style。display=“”; document。getElementById(“Javascript。LeftDiv”)。style。top=document。body。scrollTop+Toppx; document。getElementById(“Javascript。LeftDiv”)。style。left=document。body。scrollLeft+Borderpx; document。getElementById(“Javascript。RightDiv”)。style。display=“”; document。getElementById(“Javascript。RightDiv”)。style。top=document。body。scrollTop+Toppx; document。getElementById(“Javascript。RightDiv”)。style。left=document。body。scrollLeft+document。body。clientWidth-document。getElementById(“Javascript。RightDiv”)。offsetWidth-Borderpx; } function hidead() { showad = false; document。getElementById(“Javascript。LeftDiv”)。style。display=“none”; document。getElementById(“Javascript。RightDiv”)。style。display=“none”; } window。onscroll=scall; window。onresize=scall; window。onload=scall; //——> 本特效由 芯晴網頁特效丨CsrCode。Cn 收集於網際網路,只為興趣與學習交流,不作商業用途。來源:中國站長天空
對聯廣告是要用js的,在網上搜索對聯廣告有很多,把程式碼直接放入頁面中就可以使用。
如果你不會,可以到佛山建站專家上面看看。那裡有示例程式碼。
新增兩個div,設定css,浮動為fix,設定好top和left,就是他的位置……