導航:首頁 > 編程語言 > 網頁右側固定廣告代碼

網頁右側固定廣告代碼

發布時間:2023-07-04 16:45:35

A. html代碼,需要在網頁右下角彈出廣告框,並且固定,不隨網頁下拉而移動http://www.chuanyiguoji.com/

.box {
width: 0;

height: 0;

position: fixed; /* 此處為關鍵代碼,顯示在瀏覽器可視區域的右下角 */

right: 0;

bottom: 0;

}

function show() {
// 顯示的方式有很多種,這里以jquery的動畫為例

$("div.box").animate({
width : 200px;

height: 150px;

});

}

B. 網頁右邊跟隨滾動條上下移動的小廣告是怎麼做的請高手給我代碼

左欄浮動廣告
<script language=javascript>var specialcode="<DIV id=searchspe style='Z-INDEX: <script language=javascript>var specialcode="<DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 180px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='border-left:1px solid #2E6287;border-top:1px solid #2E6287;border-right:1px solid #2E6287;font-size:12px;color:#ffffff; border-bottom-color:#2E6287; border-bottom-width:1px'><TR bgcolor=#2E6287><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30>關 閉</TD></TR></TABLE><table border='1' width='150' height='500' bordercolor='#2E6287'><tr><td>廣告內容</td></tr></table></DIV>";document.write(specialcode);lastScrollY=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat0()",1);</script>

右欄浮動廣告
<script language=javascript>var specialcode="<DIV id=searchspe style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 50px;'><TABLE cellSpacing=0 cellPadding=0 width=360 style='border-left:1px solid #333333;border-top:1px solid #333333;border-right:1px solid #333333;font-size:12px;color:#ffffff'><TR bgcolor=#2E6287><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30>關 閉</TD></TR></TABLE><table border='1' width='150' id='table1' bordercolor='#2E6287' height='500'><tr><td>廣告內容</td></tr></table></DIV>";document.write(specialcode);lastScrollY=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat0()",1);</script>

左欄固定廣告
<DIV id=searchspe style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 50px;'><TABLE cellSpacing=0 cellPadding=0 width=360 style='border-left:1px solid #333333;border-top:1px solid #333333;border-right:1px solid #333333;font-size:12px;color:#ffffff'><TR bgcolor=#2E6287><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30>關 閉</TD></TR></TABLE>廣告內容</DIV>

右欄固定廣告
<DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 50px;'><TABLE cellSpacing=0 cellPadding=0 width=360 style='border-left:1px solid #333333;border-top:1px solid #333333;border-right:1px solid #333333;font-size:12px;color:#ffffff'><TR bgcolor=#2E6287><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30>關 閉</TD></TR></TABLE>廣告內容</DIV>

漂浮廣告代碼
<div id="img" style="position:absolute;; width: 200; height: 151">廣告內容</div>
<script LANGUAGE="JavaScript">
var xPos = 20;
var yPos = 10;
img.style.left= xPos;
img.style.top = yPos;
var step = 1;
var delay = 30;
var width,height,Hoffset,Woffset;
var y = 1;
var x = 1;
var interval;
img.visibility = "visible";

function changePos()
{
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
if (y)
{
yPos = yPos + step;
}
else
{
yPos = yPos - step;
}
if (yPos < 0)
{
y = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset))
{
y = 0;
yPos = (height - Hoffset);
}
if (x)
{
xPos = xPos + step;
}
else
{
xPos = xPos - step;
}
if (xPos < 0)
{
x = 1;
xPos = 0;
}
if (xPos >= (width - Woffset))
{
x = 0;
xPos = (width - Woffset);
}
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
}

function start()
{
interval = setInterval('changePos()', delay);
}

function pause_resume()
{
clearInterval(interval);
}
start();
</script>

固定對聯
<DIV id=searchspe style='Z-INDEX: 100; right: 5px; POSITION: absolute; TOP: 50px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'><TR bgcolor=#C54A00><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick=searchspe.style.visibility='hidden' width=30>關 閉</TD></TR></TABLE>
廣告內容</DIV><DIV id=searchspe2 style='Z-INDEX: 100; left: 5px; POSITION: absolute; TOP: 50px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'><TR bgcolor=#12BDFF><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick=searchspe2.style.visibility='hidden' width=30>關 閉</TD></TR></TABLE>
廣告內容</DIV>

隨動對聯
<script language=javascript>function close163news(){searchspe.style.visibility='hidden';searchspe2.style.visibility='hidden';} var specialcode="<DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 30px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'><TR bgcolor=#C54A00><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick='close163news()' width=30>關 閉</TD></TR></TABLE>廣告內容</DIV>";document.write(specialcode);lastScrollX=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollX);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollX=lastScrollX+percent;}window.setInterval("heartBeat0()",1);var specialcode2="<DIV id=searchspe2 style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 30px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'><TR bgcolor=#12BDFF><TD height=20>推薦↓</TD><TD style='CURSOR: hand' onclick='close163news()' width=30>關 閉</TD></TR></TABLE>廣告內容</DIV>";document.write(specialcode2);lastScrollY=0;function heartBeat1(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe2.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat1()",1);</script>

qq好友上線廣告代碼
<!-- 代碼開始 請將下面的代碼放到body結束標簽之前-->
<DIV id=eMeng
style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 64px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 168px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 374px; HEIGHT: 115px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
<TBODY>
<TR>
<TD
style="FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #0f2c8c"
width=30 height=24> </TD>
<TD
style="PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #1f336b; PADDING-TOP: 4px"
vAlign=center width="100%"><span class="style13">本站提示</span></TD>
<TD vAlign=center align=right width=19 2px? padding-top: 2px;
padding-right:><SPAN title=關閉
style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px"
onclick=closeDiv()>×</SPAN></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 1px"
colSpan=3 height=90><DIV
style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">
<div align="left"> <span style="text-decoration: none">
<FONT
color=#FF0000>仿造qq好友上線<br>
<center> </center>
</FONT></span></div>
</DIV></td></tr></table>
<SCRIPT language=JavaScript>
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("eMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}

function resizeDiv()
{
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}

function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
</SCRIPT>
<!-- 代碼復制結束 -->

C. 如何製作網頁左右兩邊的廣告代碼(可關閉的那種)

用以下代碼即可:
function $(id) {
return document.getElementById(id);
}
function scrollBanner(timer, moveNumber) {
function move(o) {
var st = document.documentElement.scrollTop + o.t;
var sl = document.documentElement.scrollLeft + (o.c == 0 ? o.a : document.documentElement.clientWidth - o.a - o.offsetWidth);
var tc = st - o.offsetTop, lc = sl - o.offsetLeft;
with (o.style) {
top = o.offsetTop + (tc != 0 ? tc / Math.abs(tc) : 0) * Math.min(Math.abs(tc), moveNumber) + "px";
left = o.offsetLeft + (lc != 0 ? lc / Math.abs(lc) : 0) * Math.min(Math.abs(lc), moveNumber) + "px";
}
if (o.person) {
with (o.person.style) {
top = o.offsetTop + "px";
left = o.offsetLeft + o.offsetWidth - o.person.offsetWidth + "px";
}
}
}
var hidden = function() {
var o = this.parent;
window.clearInterval(o.interval);
o.parentNode.removeChild(o);
this.parentNode.removeChild(this);
}
this.add = function (to, t, a, c, lo) {
/*
to為object對象
t為距離頂端距離
當c = 0的時候,a為距離左邊的距離
當c != 0的時候,a為距離右邊的距離
lo為關閉按鈕
*/
var div, exec = function () {
move(to);
};
to.person = lo;
to.t = t;
to.a = a;
to.c = c;
with (to.style) {
position = "absolute";
display = "block";
top = document.documentElement.scrollTop + t;
left = document.documentElement.scrollLeft + (c == 0 ? a : document.documentElement.clientWidth - a - to.offsetWidth);
}
if ("undefined" != typeof lo) {
with (lo.style) {
position = "absolute";
display = "block";
}
lo.onmousedown = hidden;
lo.parent = to;
}
exec();
to.interval = window.setInterval(exec, timer);
};
}
window.onload = function () {
var b = new scrollBanner(10,15);
b.add($("lwc"), 80, 10, 0, $("lwc_c"));
b.add($("rwc"), 80, 10, 1, $("rwc_c"));
b = null;
}

D. 求一段 廣告固定在網頁右下角的代碼(CSS或js都行),謝謝!!

推薦答案太復雜了,這個不需要js,廣告內容寬高根據實際需求進行修改就可以了。 tatooo的回答回基本正確,答主要是ie6不識別position:fixed,在補充一下ie6的樣式就完美了。

<div style=「position:fixed;_position: relative;z-index:100;right:0;bottom:0;width:100px;height:100px;」>
廣告內容
</div>

E. 怎麼將廣告固定在網頁右側

加入這段代碼
<div style="position:fixed;right:10px;top:50%;margin-top:-100px;width:100px;height:200px;border:1px #cd1b1b solid;">這里放廣告 記得改大小(就是width是寬 height是高) margin-top的數是高度的一半(別忘了專加負號)</div>
會固屬定在最右側中間 不隨網頁上下移動而改變位置

閱讀全文

與網頁右側固定廣告代碼相關的資料

熱點內容
編程和運營哪個更適合創業 瀏覽:893
尤里x怎麼升級 瀏覽:399
做業務績效考核需要哪些數據 瀏覽:433
dnf85版本劍魔刷圖加點 瀏覽:407
手機硬碟測試架可以讀取哪些數據 瀏覽:704
ug前後處理結算結果找不到文件 瀏覽:769
網頁框架拆分代碼 瀏覽:382
未來十年網路安全有什麼影響 瀏覽:362
win10更新後進不了劍靈 瀏覽:243
iphone471激活出錯 瀏覽:648
怎麼把文件拷到u盤 瀏覽:620
中伊簽署文件視頻 瀏覽:661
電信光寬頻網路不穩定 瀏覽:504
網路崗軟路由 瀏覽:995
黑莓z10在哪裡下載app 瀏覽:310
net批量下載文件 瀏覽:696
怎麼把蘋果一體機文件拷貝 瀏覽:117
sql文件怎麼寫 瀏覽:9
帝豪ec718導航升級 瀏覽:257
如何運用編程進行統計 瀏覽:570

友情鏈接