当前位置:首页 > 代码 > 正文

js网页漂浮广告代码(js网页漂浮广告代码是什么)

admin 发布:2022-12-19 23:21 151


今天给各位分享js网页漂浮广告代码的知识,其中也会对js网页漂浮广告代码是什么进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

JS漂浮广告代码

给个简单的 也需引入jquery

Html:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title/title

script type="text/javascript" src="jquery-1.4.2.min.js"/script

script type="text/javascript"

$(function(){

$('#showWin').click(showWin);

function showWin(){

$('#floatWin').show('slow');

}

})

/script

/head

body

button id="showWin"显示窗口/button

div id="floatWin"

style="right:0px;bottom:0px;display:none; width: 200px;height: 200px; background-color: #cccccc;position: absolute;"

/div

/body

/html

最近项目里正好有类似需求 代码给出来供你研究下 需要jQuery支持

有什么疑问可以hi我

(function(){

$(function(){

$.ajax({

url: messagePath+'messageBox.do',

// dataType:'json',

success:function(json){

alert(json);

showMessages(json);

}

});

})

function showMessages(json){

if(json.messagecount0){

var messageBox ="div id=\"OTOS_MESSAGEBOX_CONTAINER\""+

" table id=\"OTOS_MESSAGEBOX_HEADER\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\""+

" tr"+

" td id=\"OTOS_MESSAGEBOX_HEADER_TEXT\"/td"+

" td align=\"right\" width=\"20\"img id=\"OTOS_MESSAGEBOX_CLOSE\" style=\"cursor: pointer;\" src=\"resources/images/close.gif\"/td"+

" /tr"+

" /table"+

" table id=\"OTOS_MESSAGEBOX_CONTEXT_TITLE_TABLE\" width=\"100%\""+

" tr id=\"OTOS_MESSAGEBOX_CONTEXT_TABLE_HEADER\""+

" td标题/td"+

" td width=\"50\"类型/td"+

" td width=\"40\"发送人/td"+

" /tr"+

" /table"+

" div id=\"OTOS_MESSAGEBOX_CONTEXT\""+

" table id=\"OTOS_MESSAGEBOX_CONTEXT_TABLE\" width=\"100%\"/table"+

" /div"+

"/div";

$('body').append(messageBox);

// $('#OTOS_MESSAGEBOX_CONTAINER').jqDrag("#OTOS_MESSAGEBOX_HEADER");

$('#OTOS_MESSAGEBOX_HEADER_TEXT').text("您有"+json.messagecount+"条未读消息!");

$('#OTOS_MESSAGEBOX_CLOSE').bind('click',closeMessageBox);

$('#OTOS_MESSAGEBOX_CONTAINER').show('slow');

for(var i=0;ijson.list.length;i++){

var map = json.list[i];

$('#OTOS_MESSAGEBOX_CONTEXT_TABLE').append("tr onClick=\"toViewMessage("+map.id+",+"+map.mid+")\" class=\"OTOS_MESSAGEBOX_CONTEXT_TABLE_TR\"td"+cutTitle(map.title)+"/tdtd width=\"50\" nowarp"+map.type+"/tdtd width=\"40\""+map.sender+"/td/tr");

}

$('#OTOS_MESSAGEBOX_CONTEXT_TABLE').verticalRoll({parentid:'OTOS_MESSAGEBOX_CONTEXT'});

}

}

// 纵向滚动

$.fn.verticalRoll = function(options) {

var opts = $.extend({}, $.fn.verticalRoll.defaults, options);

if(!opts.parentid||$('#'+opts.parentid).size()1){

alert('父级不存在');

return false;

}

var $p = $('#'+opts.parentid);

var $t = $(this);

if($t.attr('tagName')!='TABLE'){

alert('不是table');

return false;

}

var s = $t.find('tr').size()

$p.css('overflow','hidden');

$t.css('position','absolute');

if(s5){

window.setInterval(function(){

var temp = $t.find('tr:first');

temp.fadeOut('slow',function(){

$t.append(temp);

temp.show();

})

},2000)

}else{

return false;

}

$.fn.verticalRoll.defaults = {}

}

})(jQuery);

function closeMessageBox(){

$('#OTOS_MESSAGEBOX_CONTAINER').hide('slow');

$('#OTOS_MESSAGEBOX_CONTAINER').fadeOut();

}

function cutTitle(title){

var temp;

if(title.length8){

temp = title.substring(0,8)+"...";

return temp

}else{

return title;

}

}

function toViewMessage(id,rid){

window.location.href = "messagesUserList.do?id="+id+"rid="+rid;

}

Css文件

@CHARSET "UTF-8";

#OTOS_MESSAGEBOX_CONTAINER {

position: absolute;

width: 240px;

height: 145px;

border: 1px solid #81b8ff;

background-color: #deecfd;

right: 0px;

bottom: 0px;

overflow:hidden;

display: none;

}

#OTOS_MESSAGEBOX_CONTAINER TD{

white-space: nowrap;

overflow: hidden;

height: 18px;

}

#OTOS_MESSAGEBOX_HEADER {

cursor: move;

border-bottom: 1px solid #81b8ff;

background-color: #9ACDFE;

overflow:hidden;

}

#OTOS_MESSAGEBOX_HEADER td {

padding: 2px;

color: #ffffff;

overflow:hidden;

}

#OTOS_MESSAGEBOX_CONTEXT {

position: relative;

height: 102px;

overflow:hidden;

}

#OTOS_MESSAGEBOX_CONTEXT td{

white-space: nowrap;

overflow: hidden;

}

#OTOS_MESSAGEBOX_HEADER_TEXT {

font-weight: bold;

overflow:hidden;

}

#OTOS_MESSAGEBOX_FOOTER {

position: relative;;

bottom: 0px;;

padding-right: 2px;;

text-align: right;

overflow:hidden;

}

.OTOS_MESSAGEBOX_CONTEXT_TABLE_TR{

cursor:pointer;

color: #336699;

overflow:hidden;

}

#OTOS_MESSAGEBOX_CONTEXT_TABLE_HEADER td{

overflow:hidden;

font-weight: bold;

overflow:hidden;

}

求一个页面上漂浮着两个浮动广告的js代码

html

head

title漂浮的图片/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

!--head头部代码开始--

script language="JavaScript" SRC="moveobj.js" /script

script

var chip1;

var chip2;

var chip3;

//根据使用的图片的多少增加或减少上面相应代码;

function pagestart()

{checkbrOK();

chip1=new Chip("chip1",160,80);

chip2=new Chip("chip2",60,80);

//根据使用的图片的多少增加或减少上面的相应代码

if(brOK)

{ movechip("chip1");

movechip("chip2");

//根据使用的图片的多少增加或减少上面的相应代码

}

}

/script

!--代码结束--

link rel="stylesheet" href="../style.css"

body onLoad="pagestart();" onUnload="if(brOK) {stopme('chip1'); stopme('chip2');}" bgcolor="#FFFFFF" text="#000000"

DIV ID="chip1" STYLE="position:absolute; width:47; height:68;"

A HREF="rm/ad1.htm"IMG SRC="ballon1.jpg" BORDER=0/a

/DIV

DIV ID="chip2" STYLE="position:absolute; width:47; height:68;"

A HREF="rm/ad2.htm"IMG SRC="ballon2.jpg" BORDER=0/a

/DIV

center

p

script src="moveobj.js"/script

/center

/body

/html

求一个右下角的漂浮广告代码?

右下角漂浮广告代码使用方法(一): 将以下代码以**.js文件形式保存,在模板中调用这个js文件即可

(备注该代码的图片大小为250*150 代码里面有参数自己看下就知道了)document.writeln("div id=\"qqaddiv\" style=\"position:absolute; z-index: 100;\" ");

document.writeln("a href=链接地址 target=_blankimg src=图片链接地址 border=0/a");

document.writeln("/div");

var bodyfrm = ( document.compatMode.toLowerCase()=="css1compat" ) ? document.documentElement : document.body;

var adst = document.getElementById("qqaddiv").style;

adst.top = ( bodyfrm.clientHeight - 150 ) + "px";

adst.left = ( bodyfrm.clientWidth - 250 ) + "px";

function moveR() {

adst.top = ( bodyfrm.scrollTop + bodyfrm.clientHeight - 150 ) + "px";

adst.left = ( bodyfrm.scrollLeft + bodyfrm.clientWidth - 250 ) + "px";

}

setInterval("moveR();", 80); 右下角漂浮广告代码使用方法(二): var qq_etewidth = 259;

var qq_eteheight = 158;

var qq_banner_filename = "广告图片链接地址";

var qq_gotoUrl = '广告链接地址';document.write("div id=eteUnionUpFloat style='margin:0px;padding-bottom:300px;z-index: 10;position:absolute;width:"+qq_etewidth+"px;height:"+qq_eteheight+"px;'")

document.write("a href='"+qq_gotoUrl+"' target='_blank'img src='"+qq_banner_filename+"' border='0' style='cursor: hand;' width='"+qq_etewidth+"' height='"+qq_eteheight+"'/a")

document.write("/div")

var bodyfrm = ( document.compatMode.toLowerCase()=="css1compat" ) ? document.documentElement : document.body;

var adst = document.getElementById("eteUnionUpFloat").style;

adst.top = ( bodyfrm.clientHeight - qq_eteheight ) + "px";

adst.left = ( bodyfrm.clientWidth - qq_etewidth ) + "px";

function moveR() {

adst.top = ( bodyfrm.scrollTop + bodyfrm.clientHeight - qq_eteheight ) + "px";

adst.left = ( bodyfrm.scrollLeft + bodyfrm.clientWidth - qq_etewidth ) + "px";

}

var objTimer=setInterval("moveR();", 100);function CloseX(){

adst.display='none';

}function ete_closediv()

{

document.getElementById('eteUnionUpFloat').style.visibility='hidden';

if(objTimer) window.clearInterval(objTimer)

}

求一个页面上漂浮着两个浮动广告的js代码,就是左右两个类似春联的条形广告,能跟随着页面上下拉动

你吧DEMO下载下来,看看是怎么回事。。不要拷贝我贴上来的JS。好吧。。。。

可下载DEMO下来自己琢磨一下

JS :

suspendcode="DIV id=lovexin1 style='Z-INDEX: 10; LEFT: 6px; POSITION: absolute; TOP: 105px; width: 100; height: 300px;'img src='images/close.gif' onClick='javascript:window.hide()' width='100' height='14' border='0' vspace='3' alt='关闭对联广告'a href='' target='_blank'img src='images/ad_100x300.jpg' width='100' height='300' border='0'/a/DIV"

document.write(suspendcode);

suspendcode="DIV id=lovexin2 style='Z-INDEX: 10; LEFT: 896px; POSITION: absolute; TOP: 105px; width: 100; height: 300px;'img src='images/close.gif' onClick='javascript:window.hide()' width='100' height='14' border='0' vspace='3' alt='关闭对联广告'a href='' target='_blank'img src='images/ad_100x300.jpg' width='100' height='300' border='0'/a/DIV"

document.write(suspendcode);

//flash格式调用方法

//EMBED src='flash.swf' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=ad wmode=opaque/EMBED

lastScrollY=0;

function heartBeat(){

diffY=document.body.scrollTop;

percent=.3*(diffY-lastScrollY);

if(percent0)percent=Math.ceil(percent);

else percent=Math.floor(percent);

document.all.lovexin1.style.pixelTop+=percent;

document.all.lovexin2.style.pixelTop+=percent;

lastScrollY=lastScrollY+percent;

}

function hide()

{

lovexin1.style.visibility="hidden";

lovexin2.style.visibility="hidden";

}

window.setInterval("heartBeat()",1);

网站漂浮广告代码怎么写

script type="text/javascript"

function hidead()

{document.getElementById("ad").style.display="none";}

/script

div id="ad" style="position:absolute"

!--放广告代码--DIV onClick="hidead();" style="FONT-SIZE: 9pt; CURSOR: hand" align=right关闭广告×/DIV/div

script

var x = 80,y = 80

var xin = true, yin = true

var step = 1

var delay = 1

var obj=document.getElementById("ad")

function floatAD() {

var L=T=0

var R= document.body.clientWidth-obj.offsetWidth

var B = document.body.clientHeight-obj.offsetHeight

obj.style.left = x + document.body.scrollLeft

obj.style.top = y + document.body.scrollTop

x = x + step*(xin?1:-1)

if (x L) { xin = true; x = L}

if (x R){ xin = false; x = R}

y = y + step*(yin?1:-1)

if (y T) { yin = true; y = T }

if (y B) { yin = false; y = B }

}

var itl= setInterval("floatAD()", delay)

obj.onmouseover=function(){clearInterval(itl)}

obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}

/script

关于js网页漂浮广告代码和js网页漂浮广告代码是什么的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/29889.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载