网页漂浮广告代码
JS漂浮广告代码
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
obj.onmouseover=function(){clearInterval(interval);}
obj.onmouseout=function(){interval=setInterval(obj.CustomMethod, delay);}
}
}
***** content ******
</div>
var ad=new AdMove("Div2");
ad.Run();
*/
////////////////////////////////////////////////////////
var AdMoveConfig=new Object();
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {
xScroll = document.body.scrollLeft;
}
if (self.pageYOffset) {
yScroll = self.pageYOffset;
}
var obj=document.getElementById(id);
obj.style.position="absolute";
var W=AdMoveConfig.MoveWidth-obj.offsetWidth;
常用网页漂浮广告代码
常用网页漂浮广告代码代码:1.<body bgcolor="#F7F7F7"><!--图片漂浮广告代码开始--><div id="www_qpsh_com" style="position:absolute"> <!--链接地址--><a href="链接地址"target="_blank"><!--图片地址--><img src="图片地址" border="0"> </a></div><script>var x = 50,y = 60var xin = true, yin = truevar step = 1var delay = 10var obj=document.getElementById("www_qpsh_com") function floatwww_qpsh_com() {var L=T=0var R= document.body.clientWidth-obj.offsetWidthvar B = document.body.clientHeight-obj.offsetHeight obj.style.left = x + document.body.scrollLeftobj.style.top = y + document.body.scrollTopx = 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("floatwww_qpsh_com()", delay)obj.onmouseover=function(){clearInterval(itl)}obj.onmouseout=function(){itl=setInterval("floatwww_qpsh _com()", delay)}</script><!--图片漂浮广告代码结束--></body>2.<body bgcolor="#F7F7F7"><!--图片漂浮广告代码开始--><div id="www_qpsh_com" style="position:absolute"> <!--链接地址--><a href="链接地址"target="_blank"><!--图片地址--><img src="图片地址" border="0"> </a></div><script>var x = 50,y = 60var xin = true, yin = truevar step = 1var delay = 10var obj=document.getElementById("www_qpsh_com") function floatwww_qpsh_com() {var L=T=0var R= document.body.clientWidth-obj.offsetWidthvar B = document.body.clientHeight-obj.offsetHeight obj.style.left = x + document.body.scrollLeftobj.style.top = y + document.body.scrollTopx = 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("floatwww_qpsh_com()", delay)obj.onmouseover=function(){clearInterval(itl)}obj.onmouseout=function(){itl=setInterval("floatwww_qpsh _com()", delay)}</script><!--图片漂浮广告代码结束--></body>。
各类漂浮广告代码、弹窗广告代码大全
</SCRIPT>
参数解释:
<SCRIPT LANGUAGE="java script"> js脚本开始;
window.open 弹出新窗口的命令;
'page.html' 弹出窗口的文件名;
'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;
window.open(′url′,′窗口名′,′属性列表′);
〈/script〉
其中“url”是在窗口中显示的html文档的地址;“窗口名”可任意起一个,但不要用中文;“属性列表”是一个用逗号分开的各个属性值的字符串,它确定了弹出窗口的外观与状态。常用属性有:
toolbar(是否显示工具栏
将下面这段代码插入你的页面中,在页面加载时就会自动弹出一个窗口,并打开Google搜索引擎,是不是很简单啊!
将代码放置在〈!?XXX --〉中间是为了兼容较低版本浏览器的需要,在低版本的浏览器中标签内的内容将被视作注视。
打开的页面使用绝对路径(http://)或相对路径(../page.htm)都可以。
-->
</script>
然后,在相同目录下新建一个popup.htm网页(注意要与上面的url对应!),用于显示在弹出窗口中。在新建文件的源代码中加入如下代码:
代码:
<script language="java script">
function closeit() {
setTimeout("self.close()",10000)
网页上漂浮的客服代码(漂浮框架兼容各大浏览器)
常见网页上的漂浮客服窗口,是一个漂浮框架,各位可以拿去用。
在chrome、ie、firefox下测试正常。
以下是部分代码(可点击演示查看或直接下载源代码):<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>网站客服漂浮框架(兼容各大浏览器)-网页特效代码()</title><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /><style type="text/css">.kfoutbox{position:absolute;z-index:10000;right:5px;margin:0px;width:80px;height:150p x;background:#ff0000;}</style></head><body style="margin:0px;padding:0px;font-size:12px;"><div style="margin:0pxauto;padding-top:200px;width:980px;height:800px;text-align:center;background:#f2f2f2 ;">这里是网页的内容区<br><a href="/">网页特效代码</a></div><div id="kfoutbox" class="kfoutbox"><span id="kfboxclose" style="color:#ffffff">关闭按钮</span></div><script language="javascript">var default_top_ps = 100;var evans_agt = erAgent.toLowerCase();var evans_ie = ((evans_agt.indexOf("msie") != -1) && (evans_agt.indexOf("opera") == -1) && (evans_agt.indexOf("omniweb") == -1));var evans_mymovey = new Number();function evans_IeTrueBody() {return (patMode && patMode != "BackCompat") ? document.documentElement: document.body}function evans_GetScrollTop() {return evans_ie ? evans_IeTrueBody().scrollTop: window.pageYOffset}function evans_heartBeat() {evans_diffY = evans_GetScrollTop();evans_mymovey += Math.floor((evans_diffY -document.getElementById('kfoutbox').style.top.replace("px", "") + default_top_ps) * 0.1); document.getElementById('kfoutbox').style.top = evans_mymovey + "px"}var evans_tmpintval = window.setInterval("evans_heartBeat()", 1);if (document.getElementById('kfboxclose')) {document.getElementById('kfboxclose').onclick = function() {window.clearInterval(evans_tmpintval);document.getElementById('kfoutbox').style.display = 'none'}}var popupdelay = 0;var maxpoptimes = 3;var prepoptime = '10';function Tong_MoveDiv() {this.Move = function(Id, Evt, T) {if (Id == "") {return}var o = document.getElementById(Id);if (!o) {return}evt = Evt ? Evt: window.event;o.style.position = "absolute";o.style.zIndex = 200;var obj = evt.srcElement ? evt.srcElement: evt.target;var w = o.offsetWidth;var h = o.offsetHeight;var l = o.offsetLeft;var t = o.offsetTop;var div = document.createElement("DIV");document.body.appendChild(div);div.style.cssText = "filter:alpha(Opacity=10,style=0);opacity:0.2;width:" + w + "px;height:" + h + "px;top:" + t + "px;left:" + l + "px;position:absolute;background:#000";div.setAttribute("id", Id + "temp");this.Move_OnlyMove(Id, evt, T)};this.Move_OnlyMove = function(Id, Evt, T) {var o = document.getElementById(Id + "temp");if (!o) {return}var evt = Evt ? Evt: window.event;var relLeft = evt.clientX - o.offsetLeft;var relTop = evt.clientY - o.offsetTop;if (!window.captureEvents) {o.setCapture()} else {window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP)}document.onmousemove = function(e) {if (!o) {return}e = e ? e: window.event;var bh = Math.max(document.body.scrollHeight, document.body.clientHeight, document.body.offsetHeight, document.documentElement.scrollHeight,document.documentElement.clientHeight, document.documentElement.offsetHeight);var bw = Math.max(document.body.scrollWidth, document.body.clientWidth, document.body.offsetWidth, document.documentElement.scrollWidth,document.documentElement.clientWidth, document.documentElement.offsetWidth);var sbw = 0;if (document.body.scrollWidth < bw) sbw = document.body.scrollWidth;if (document.body.clientWidth < bw && sbw < document.body.clientWidth) sbw = document.body.clientWidth;if (document.body.offsetWidth < bw && sbw < document.body.offsetWidth) sbw = document.body.offsetWidth;if (document.documentElement.scrollWidth < bw && sbw <document.documentElement.scrollWidth) sbw = document.documentElement.scrollWidth;if (document.documentElement.clientWidth < bw && sbw <document.documentElement.clientWidth) sbw = document.documentElement.clientWidth;if (document.documentElement.offsetWidth < bw && sbw <document.documentElement.offsetWidth) sbw = document.documentElement.offsetWidth;if (e.clientX - relLeft <= 0) {o.style.left = 0 + "px"} else if (e.clientX - relLeft >= bw - o.offsetWidth - 2) {o.style.left = (sbw - o.offsetWidth - 2) + "px"} else {o.style.left = e.clientX - relLeft + "px"}if (e.clientY - relTop <= 1) {o.style.top = 1 + "px"} else if (e.clientY - relTop >= bh - o.offsetHeight - 30) {o.style.top = (bh - o.offsetHeight) + "px"} else {o.style.top = e.clientY - relTop + "px"}};document.onmouseup = function() {if (!o) return;if (!window.captureEvents) {o.releaseCapture()} else {window.releaseEvents(Event.MOUSEMOVE | Event.MOUSEUP) }var o1 = document.getElementById(Id);if (!o1) {return}var l0 = o.offsetLeft;var t0 = o.offsetTop;var l = o1.offsetLeft;var t = o1.offsetTop;Kf54MyMove.Move_e(Id, l0, t0, l, t, T);document.body.removeChild(o);o = null}};this.Move_e = function(Id, l0, t0, l, t, T) {if (typeof(window["ct" + Id]) != "undefined") {clearTimeout(window["ct" + Id])}var o = document.getElementById(Id);if (!o) return;var sl = st = 8;var s_l = Math.abs(l0 - l);var s_t = Math.abs(t0 - t);if (s_l - s_t > 0) {if (s_t) {sl = Math.round(s_l / s_t) > 8 ? 8 : Math.round(s_l / s_t) * 6 } else {sl = 0}} else {if (s_l) {st = Math.round(s_t / s_l) > 8 ? 8 : Math.round(s_t / s_l) * 6 } else {st = 0}}if (l0 - l < 0) {sl *= -1}if (t0 - t < 0) {st *= -1}if (Math.abs(l + sl - l0) < 52 && sl) {sl = sl > 0 ? 2 : -2}if (Math.abs(t + st - t0) < 52 && st) {st = st > 0 ? 2 : -2}if (Math.abs(l + sl - l0) < 16 && sl) {sl = sl > 0 ? 1 : -1}if (Math.abs(t + st - t0) < 16 && st) {st = st > 0 ? 1 : -1}if (s_l == 0 && s_t == 0) {return}if (T) {o.style.left = l0 + "px";o.style.top = t0 + "px";return} else {if (Math.abs(l + sl - l0) < 2) {o.style.left = l0 + "px"} else {o.style.left = l + sl + "px"}if (Math.abs(t + st - t0) < 2) {o.style.top = t0 + "px"} else {o.style.top = t + st + "px"}window["ct" + Id] = window.setTimeout("Kf54MyMove.Move_e('" + Id + "', " + l0 + " , " + t0 + ", " + (l + sl) + ", " + (t + st) + "," + T + ")", 1)}}};</script></body></html>。
网站JS浮动广告代码
网站Js浮动广告代码//JS代码:var delta=0.08var collection;function floaters() {this.items = [];this.addItem = function(id,x,y,content){document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+cont ent+'</DIV>');var newItem = {};newItem.object = document.getElementById(id);newItem.x = x;newItem.y = y;this.items[this.items.length] = newItem;}this.play = function(){collection = this.itemssetInterval('play()',10);}}function play(){for(var i=0;i<collection.length;i++){var followObj = collection[i].object;var followObj_x =(typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);var followObj_y =(typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {vardx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));followObj.style.left=followObj.offsetLeft+dx;}if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {vardy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));followObj.style.top=followObj.offsetTop+dy;}followObj.style.display = '';}}var theFloaters = new floaters();//右侧浮动广告代码(QQ对话栏):theFloaters.addItem('followDiv1','document.body.clientWidth-140',195,'<a target="_blank" href="/msgrd?v=3&uin=2357484552&site=qq&menu=yes"><img border="0" src="/pa?p=2:2357484552:53" alt="give me message" title="click here"></a>');//左侧浮动广告代码(可调用flash或图片):theFloaters.addItem('followDiv2',6,80,'<EMBED src="..." quality=high WIDTH=100 HEIGHT=300 TYPE=application/x-shockwave-flash id=ad wmode=opaque></EMBED>');theFloaters.play();//广告图片的调用方法://<a href=/lanren/ target=_blank><img src=images/ad_100x300.jpg border=0></a>。
网页浮动窗口代码
1. 右栏浮动广告QUOTE:<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' id='table1' height='500' bordercolor='#2E6287'><tr><td>广告内容</td></tr></table></DIV>";document.write(specialcode);lastScrollY=0;functionheartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percen t=Math.ceil(percent);elsepercent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScr ollY+percent;}window.setInterval("heartBeat0()",1);</script>2.左栏浮动广告QUOTE:<script language=javascript>var specialcode="<DI V 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;functionheartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percen t=Math.ceil(percent);elsepercent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollY=lastScr ollY+percent;}window.setInterval("heartBeat0()",1);</script>3.左栏固定广告QUOTE:<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>4.右栏固定广告QUOTE:<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>5.漂浮广告代码QUOTE:<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>6.固定对联QUOTE:<DIV id=searchspe style='Z-INDEX: 100; right: 5px; POSITION: absolute; TOP: 50px;'><TABLE cellSpac ing=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>7.随动对联QUOTE:<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 cellSpac ing=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)percen t=Math.ceil(percent);elsepercent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollX=lastScr ollX+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)percen t=Math.ceil(percent);elsepercent=Math.floor(percent);document.all.searchspe2.style.pixelTop+=percent;lastScrollY=lastSc rollY+percent;}window.setInterval("heartBeat1()",1);</script>8.qq好友上线广告代码QUOTE:<!-- 代码开始请将下面的代码放到body结束标签之前--><DIV id=eMengstyle="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><TDstyle="FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #0f2c8c"width=30 height=24> </TD><TDstyle="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><TDstyle="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 1px" colSpan=3 height=90><DIVstyle="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"><FONTcolor=#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;// divHeightdocument.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidthdocument.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>9:网页中的分享代码:<div id="ckepop"><a title="分享到新浪微博" class="jiathis_button_tsina"></a><a title="分享到QQ收藏" class="jiathis_button_qq"></a><a title="分享到开心网" class="jiathis_button_kaixin001"></a><a title="分享到人人网" class="jiathis_button_renren"></a><span class="separator">|</span><a href="/share/" class="jiathis button jtico jtico_more" target="_blank">更多</a> </div> <script type="text/javascript" src="/code/jia.js" charset="utf-8 "></script>是不是觉得图标太少了?来分析下这段JS。
网页两边悬浮窗广告代码
<html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>悬浮广告</title></head><body><div style="height:900px; display:block;"></div><div id="AdLayer1" style='position: absolute; ;z-index:1; left:100px; border:1px #DDD solid; width:36px; height:200px; background-color:#CCC;'></div><div id="AdLayer2" style='position: absolute; ;z-index:1; right:100px; border:1px #DDD solid; width:36px; height:200px; background-color:green;'></div><script type="text/javascript">// 页面初始化function initEcAd() {document.all.AdLayer1.style.posTop = 200;document.all.AdLayer1.style.visibility = 'visible'document.all.AdLayer2.style.posTop = 200;document.all.AdLayer2.style.visibility = 'visible'MoveLeftLayer('AdLayer1');MoveRightLayer('AdLayer2');}// 移动左面的广告层function MoveLeftLayer(layerName) {var x = 100;var y = 100;// 左侧广告距离页首高度var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;var y = document.body.scrollTop + y - diff;eval("document.all." + layerName + ".style.posTop = parseInt(y)");eval("document.all." + layerName + ".style.posLeft = x");setTimeout("MoveLeftLayer('AdLayer1');", 20);}// 移动右边的广告层function MoveRightLayer(layerName) {var x = 100;var y = 100;// 右侧广告距离页首高度var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;var y = document.body.scrollTop + y - diff;eval("document.all." + layerName + ".style.posTop = y");eval("document.all." + layerName + ".style.posRight = x");setTimeout("MoveRightLayer('AdLayer2');", 20);}initEcAd()</script> </body> </html>。
超简单无缝滚动漂浮广告代码属性
超简单⽆缝滚动漂浮⼴告代码属性实现功能:1、⽆缝滚动(左右上下)2、漂浮⼴告(包括在屏幕漂浮⼏次消失)两个事件onmouseover="this.stop()" ⿏标划过停⽌滚动onmouseout="this.start()" ⿏标离开继续滚动<marquee width="920" onmouseover="this.stop()" onmouseout="this.start()" scrollamount="20" behavior="scroll" align="absbottom"> @foreach (var item in Model.NewsItems_WebNotice){<u><a href="@Url.RouteUrl("NewsItem", new { SeName = item.SeName })">@Html.StrTruncation(item.Title, 10)</a></u>}</marquee>Marquee 属性列表:align设定<marquee>标签内容的对齐⽅式absbottom:绝对底部对齐(与g、p等字母的最下端对齐)absmiddle:绝对中央对齐baseline:底线对齐bottom:底部对齐(默认)left:左对齐middle:中间对齐right:右对齐texttop:顶线对齐top:顶部对齐behavior设定滚动的⽅式:alternate:表⽰在两端之间来回滚动。
scroll:表⽰由⼀端滚动到另⼀端,会重复。
slide:表⽰由⼀端滚动到另⼀端,不会重复scrollamount="5":设置滚动的速度direction设定活动字幕的滚动⽅向代码如下:<marquee direction="down">设定活动字幕的滚动⽅向direction="down":向下</marquee><marquee direction="left">设定活动字幕的滚动⽅向direction="left":向左</marquee><marquee direction="right">设定活动字幕的滚动⽅向direction="right":向右</marquee><marquee direction="up">设定活动字幕的滚动⽅向direction="up":向上</marquee>hspace设定活动字幕⾥所在的位置距离⽗容器⽔平边框的距离This controls the horizontal(⽔平)space around thedisplay box.代码如下:<table width="500"border="1" align="center" cellpadding="0"cellspacing="0"><tr><td><marquee hspace="100"bgcolor="#CCCCCC">hspace="100"</marquee></td></tr></table>loop设定滚动的次数,当loop=-1表⽰⼀直滚动下去,默认为-1Marquee标记⽤于在可⽤浏览区域中滚动⽂本。
网页两边悬浮窗广告代码
<html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>悬浮广告</title></head><body><div style="height:900px; display:block;"></div><div id="AdLayer1" style='position: absolute; ;z-index:1; left:100px; border:1px #DDD solid; width:36px; height:200px; background-color:#CCC;'></div><div id="AdLayer2" style='position: absolute; ;z-index:1; right:100px; border:1px #DDD solid; width:36px; height:200px; background-color:green;'></div><script type="text/javascript">// 页面初始化function initEcAd() {document.all.AdLayer1.style.posTop = 200;document.all.AdLayer1.style.visibility = 'visible'document.all.AdLayer2.style.posTop = 200;document.all.AdLayer2.style.visibility = 'visible'MoveLeftLayer('AdLayer1');MoveRightLayer('AdLayer2');}// 移动左面的广告层function MoveLeftLayer(layerName) {var x = 100;var y = 100;// 左侧广告距离页首高度var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;var y = document.body.scrollTop + y - diff;eval("document.all." + layerName + ".style.posTop = parseInt(y)");eval("document.all." + layerName + ".style.posLeft = x");setTimeout("MoveLeftLayer('AdLayer1');", 20);}// 移动右边的广告层function MoveRightLayer(layerName) {var x = 100;var y = 100;// 右侧广告距离页首高度var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;var y = document.body.scrollTop + y - diff;eval("document.all." + layerName + ".style.posTop = y");eval("document.all." + layerName + ".style.posRight = x");setTimeout("MoveRightLayer('AdLayer2');", 20);}initEcAd()</script> </body> </html>。
JS实现悬浮移动窗口(悬浮广告)的特效
JS实现悬浮移动窗⼝(悬浮⼴告)的特效js⽅法:复制代码代码如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "/TR/html4/loose.dtd"><html><head><title> New Document </title><meta name="Generator" content="EditPlus"><meta name="Author" content=""><meta name="Keywords" content=""><meta name="Description" content=""><script type="text/javascript">window.onload=function(){//写⼊var oneInner = document.createElement("div");oneInner.setAttribute("style","background:#663398;position:absolute;width:100px;height:100px;border:solid 3px #2F74A7;cursor:pointer;");var oneButton = document.createElement("input");oneButton.setAttribute("type","button");oneButton.setAttribute("value","x");if (oneButton.style.cssFloat){oneButton.style.cssFloat="right"}else{oneButton.style.styleFloat="right"}oneInner.appendChild(oneButton);document.body.appendChild(oneInner);//定时器var a1a = setInterval(moves,100);//函数var x = 10;var y = 10;function moves(){var tops = oneInner.offsetTopvar lefts = oneInner.offsetLeftif (lefts>=document.documentElement.clientWidth-oneInner.offsetWidth||lefts<=0){x=-x}if (tops>=document.documentElement.clientHeight-oneInner.offsetHeight||tops<=0){y=-y}tops+=y;lefts+=x;oneInner.style.top=tops+"px"oneInner.style.left=lefts+"px"}//悬停停⽌oneInner.onmouseover=function(){clearInterval(a1a);}//放⼿继续运动oneInner.onmouseout=function(){a1a =setInterval(moves,100);}//删除oneButton.onclick=function(){document.body.removeChild(oneInner);}}</script></head><body></body></html>jquery⽅法:复制代码代码如下:<!DOCTYPE html><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" src="https:///workspace/js/jquery-1.7.min.js"></script><script>$(function(){//写⼊div$("<div/>",{id:"moveWindow"}).css({width:"200px",height:"200px",border:"solid 3px#2F74A7",background:"#663398",position:"absolute",cursor:"pointer"}).appendTo("body");//写⼊关闭按钮$("<div/>",{id:"removeMW"}).css({width:"20px",height:"20px",background:"red",float:"right"}).appendTo("#moveWindow"); //定时器var move = setInterval(moves,100);var x= 10;var y= 10;function moves (){var mw = $("#moveWindow").offset();var lefts =mw.left;var tops = mw.top;if (lefts>=$(window).width()-$("#moveWindow").width()||lefts<=0){x=-x}if (tops>=$(window).height()-$("#moveWindow").height()||tops<=0){y=-y}lefts+=x;tops+=y;$("#moveWindow").offset({top:tops,left:lefts});}//悬停停⽌运动$("#moveWindow").mouseover(function(){clearInterval(move);});//移开⿏标后继续运动$("#moveWindow").mouseout(function(){move = setInterval(moves,100);});//点击按钮关闭$("#removeMW").click(function(){$("#moveWindow").remove();});})</script></head><body></body></html>基本思路:1.页⾯加载完成之后向页⾯插⼊窗⼝,之后向窗⼝插⼊关闭按钮2.使⽤setInterval()函数触发moves()函数开始动画3.moves函数:⾸先获取当前窗⼝位置,之后随时间使窗⼝位移,每当位移到游览器边缘时反向运动4.添加其他事件:⿏标悬停停⽌运动,⿏标离开继续运动,点击按钮关闭窗⼝ps:不建议使⽤这个特效,影响⽤户体验希望对你有所帮助!^_^!~~。
在网页上设计飘动广告
在网页上设计飘动广告2008-12-20 17:25:04 【大中小】评论:0条点击:73把下面的代码加入<head>...</head>之间:var brOK=false;var mie=false;var aver=parseInt(navigator.appVersion.substring(0,1));var aname=navigator.appName;//check browserfunction checkbrOK(){if(aname.indexOf("Internet Explorer")!=-1){if(aver>=4)brOK=navigator.javaEnabled();mie=true;}if(aname.indexOf("Netscape")!=-1){if(aver>=4)brOK=navigator.javaEnabled();}}var vmin=5;var vmax=2;var vr=2;var timer1;function Chip(chipname,width,height){d=chipname;this.vx=vmin vmax*Math.random();this.vy=vmin vmax*Math.random();this.w=width;this.h=height;this.xx=0;this.yy=0;this.timer1=null;}function movechip(chipname){if(brOK){eval("chip=" chipname);if(!mie){pageX=window.pageXOffset;pageW=window.innerWidth;pageY=window.pageYOffset;pageH=window.innerHeight;}else{pageX=window.document.body.scrollLeft;pageW=window.document.body.offsetWidth-8;pageY=window.document.body.scrollTop;pageH=window.document.body.offsetHeight;}chip.xx=chip.xx chip.vx;chip.yy=chip.yy chip.vy;chip.vx =vr*(Math.random()-0.5);chip.vy =vr*(Math.random()-0.5);if(chip.vx>(vmax vmin)) chip.vx=(vmax vmin)*2-chip.vx; if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx; if(chip.vy>(vmax vmin)) chip.vy=(vmax vmin)*2-chip.vy; if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy; if(chip.xx<=pageX){chip.xx=pageX;chip.vx=vmin vmax*Math.random();}if(chip.xx>=pageX pageW-chip.w){chip.xx=pageX pageW-chip.w;chip.vx=-vmin-vmax*Math.random();}if(chip.yy<=pageY){chip.yy=pageY;chip.vy=vmin vmax*Math.random();}if(chip.yy>=pageY pageH-chip.h){chip.yy=pageY pageH-chip.h;chip.vy=-vmin-vmax*Math.random();}if(!mie){eval("document." d ".top =" chip.yy);eval("document." d ".left=" chip.xx);}else{eval("document.all." d ".style.pixelLeft=" chip.xx); eval("document.all." d ".style.pixelTop =" chip.yy); }chip.timer1=setTimeout("movechip("" d "")",100); }}function stopme(chipname){if(brOK){//alert(chipname)eval("chip=" chipname);if(chip.timer1!=null){clearTimeout(chip.timer1);}}}var floater;function floater(){checkbrOK();floater=new Chip("floater",0,0);if(brOK){movechip("floater");}}把下面的代码加入<body>...</body>之间:<div id=floater style="HEIGHT: 0px; POSITION: absolute; WIDTH: 0px; left: 680px; top: 150px; z-index:100" ><a href= arget=_blank><img border=0 src=/images/LOGO.gif></a></div>这里你可以改成自己要的图片路径.。
页面云朵飘飘——网页特效
页面云朵飘飘——网页特效页面云朵飘飘——网页特效代码:脚本说明:把如下代码加入<body>区域中<script language="JavaScript1.2"><!-- Beginvar no = 20; // image number or falling ratevar speed = 2; // the lower the number the faster the image movesvar snow = new Array();snow[0] = "bubble1.gif"snow[1] = "bubble1.gif"snow[2] = "bubble1.gif"var ns4up = (yers) ? 1 : 0; // browser sniffervar ie4up = (document.all) ? 1 : 0;var ns6up = (document.getElementById&&!document.all) ?1 : 0;var dx, xp, yp; // coordinate and position variablesvar am, stx, sty; // amplitude and step variablesvar i, doc_width = 800, doc_height = 1800;if (ns4up||ns6up) {doc_width = self.innerWidth;doc_height = self.innerHeight;} else if (ie4up) {doc_width = document.body.clientWidth;doc_height = document.body.clientHeight;}dx = new Array();xp = new Array();yp = new Array();am = new Array();stx = new Array();sty = new Array();j = 0;for (i = 0; i < no; ++ i) {dx[i] = 0; // set coordinate variablesxp[i] = Math.random()*(doc_width-50); // set position variablesyp[i] = Math.random()*doc_height;am[i] = Math.random()*20; // set amplitude variables stx[i] = 0.02 + Math.random()/10; // set step variablessty[i] = 0.7 + Math.random(); // set step variablesif (ns4up) { // set layersif (i == 0) {document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");} else {document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>");} } else if (ie4up||ns6up) { if (i == 0){document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");} else {document.write("<div id=\"dot"+ i +"\" style=\"POSITION:absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>");}}if (j == (snow.length-1)) { j = 0; } else { j += 1; }}function snowNS() { // Netscape main animation function for (i = 0; i < no; ++ i) { // iterate for every dotyp[i] -= sty[i]; if (yp[i] < -50) {xp[i] = Math.random()*(doc_width-am[i]-30);yp[i] = doc_height;stx[i] = 0.02 + Math.random()/10;sty[i] = 0.7 + Math.random();doc_width = self.innerWidth;doc_height = self.innerHeight; }dx[i] += stx[i];yers["dot"+i].top = yp[i];yers["dot"+i].left = xp[i] +am[i]*Math.sin(dx[i]);}setTimeout("snowNS()", speed);}function snowIE_NS6() { // IE main animation functionfor (i = 0; i < no; ++ i) { // iterate for every dotyp[i] -= sty[i];if (yp[i] < -50) {xp[i] = Math.random()*(doc_width-am[i]-30);yp[i] = doc_height;stx[i] = 0.02 + Math.random()/10;sty[i] = 0.7 + Math.random();doc_width = ns6up?window.innerWidth-5:document.body.clientWidth;doc_height = ns6up?window.innerHeight-5:document.body.clientHeight;}dx[i] += stx[i];if (ie4up){document.all["dot"+i].style.pixelTop = yp[i];document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);}else if (ns6up){document.getElementById("dot"+i).style.top=yp[i];document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]);}}setTimeout("snowIE_NS6()", speed);}if (ns4up) {snowNS();} else if (ie4up||ns6up) {snowIE_NS6();}// End --></script>。
浮动广告代码
注:浮动广告代码:<SCRIPT language=JavaScript>self.onError=null;currentX = currentY = 0;whichIt = null;lastScrollX = 0; lastScrollY = 0;NS = (yers) ? 1 : 0;IE = (document.all) ? 1: 0;function heartBeat() {if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }if(diffY != lastScrollY) {percent = .1 * (diffY - lastScrollY);if(percent > 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.sohususpend.style.pixelTop += percent;if(NS) document.sohususpend.top += percent;lastScrollY = lastScrollY + percent;}if(diffX != lastScrollX) {percent = .1 * (diffX - lastScrollX);if(percent > 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.sohususpend.style.pixelLeft += percent;if(NS) document.sohususpend.left += percent;lastScrollX = lastScrollX + percent;}}function checkFocus(x,y) {stalkerx = document.sohususpend.pageX;stalkery = document.sohususpend.pageY;stalkerwidth = document.sohususpend.clip.width;stalkerheight = document.sohususpend.clip.height;if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;else return false;}function grabIt(e) {if(IE) {whichIt = event.srcElement;while (whichIt.id.indexOf("sohususpend") == -1) {whichIt = whichIt.parentElement;if (whichIt == null) { return true; }}whichIt.style.pixelLeft = whichIt.offsetLeft;whichIt.style.pixelTop = whichIt.offsetTop;currentX = (event.clientX + document.body.scrollLeft);currentY = (event.clientY + document.body.scrollTop);} else {window.captureEvents(Event.MOUSEDOWN);if(checkFocus (e.pageX,e.pageY)) {whichIt = document.sohususpend;StalkerTouchedX = e.pageX-document.sohususpend.pageX;StalkerTouchedY = e.pageY-document.sohususpend.pageY;}}return true;}function moveIt(e) {if (whichIt == null) { return false; }if(IE) {newX = (event.clientX + document.body.scrollLeft);newY = (event.clientY + document.body.scrollTop);distanceX = (newX - currentX); distanceY = (newY - currentY);currentX = newX; currentY = newY;whichIt.style.pixelLeft += distanceX;whichIt.style.pixelTop += distanceY;if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;if(whichIt.style.pixelLeft > document.body.offsetWidth -document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;if(whichIt.style.pixelTop > document.body.offsetHeight +document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;event.returnValue = false;} else {whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;if( (whichIt.left + whichIt.clip.width) >=(window.innerWidth+self.pageXOffset-17)) whichIt.left =((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;if( (whichIt.top + whichIt.clip.height) >=(window.innerHeight+self.pageYOffset-17)) whichIt.top =((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;return false;}return false;}function dropIt() {whichIt = null;if(NS) window.releaseEvents (Event.MOUSEDOWN);return true;}if(NS) {window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN); window.onmousedown = grabIt;window.onmousemove = moveIt;window.onmouseup = dropIt;}if(IE) {document.onmousedown = grabIt;document.onmousemove = moveIt;document.onmouseup = dropIt;}if(NS || IE) action = window.setInterval("heartBeat()",1);</SCRIPT>。
网页上漂浮的客服代码(漂浮框架兼容各大浏览器)
网页上漂浮的客服代码(漂浮框架兼容各大浏览器)第一篇:网页上漂浮的客服代码(漂浮框架兼容各大浏览器) 常见网页上的漂浮客服窗口,是一个漂浮框架,各位可以拿去用。
在chrome、ie、firefox下测试正常。
以下是部分代码(可点击演示查看或直接下载源代码):.kfoutbox{position:absolute;z-index:10000;right:5px;margin:0px;width:80px;height:150px;back ground:#ff0000;}这里是网页的内容区第二篇:《漂浮》四年级上美术教案《漂浮》四年级上美术教案漂浮教学内容与目标、显性内容与目标应知:通过本学习,学生初步探索有关浮力的知识,并能根据身边的废旧材料进行有创意的设计。
应会:结合绘画、粘贴、插接等不同造型手法,以及漂浮的科学道理,利用生活中的废旧物品实现自己的艺术创想。
2、隐性内容与目标通过本学习,培养学生将艺术创造与科学研究完美结合的意识,以及发现问题、分析问题、解决问题的能力,激发他们热爱生活、关注生活的美好情感。
教学重点:启发学生探究简单的浮力知识,并结合身边废旧物品进行有创意的设计与制作。
教学难点:在制作漂浮物时,创新地使用材料,制作方法精细。
教学过程:一、游戏导人游戏l:发给学生每人一支吸管,提出游戏要求:你能想到几种令吸管在水中漂浮起来的方法?游戏2:抢答——如果给你一把吸管,让它们漂浮在水面上.设想一下都可能有哪些不同的造型?二、思考反馈吸管为什么可以漂浮?铁很重,为什么轮船却能漂浮在海上?三、信息交流组织学生进行信息交流。
哪位科学家最早发现了浮力?你知道有哪些关于浮力的小故事吗?四、合作探究组织学生分组探究:在我们身边,还有哪些材料可以漂浮?看一看:书中同学作品给了你哪些启发?试一试:运用折、剪、卷、组合等不同手段,你能用手边的材料组织什么样的漂浮物的造型?讲一讲:你能设想一下它的功能及装饰吗?五、探索实践提出作业要求:利用身边的废旧材料,制作一个能浮在水面上的新颖美观的玩具。
漂浮窗口代码
星 11.5.6 14:48:42<script type="text/javascript">function hidead(){document.getElementById("ad").style.display="none";}</script><div id="ad" style="position:absolute"><a href="这里填你要连接到的网页地址" target="_blank"><img src="这个引号中间填图片路径" ></a><DIV style="FONT-SIZE: 9pt; CURSOR: hand" align=right>关闭×</DIV></div><script>var x = 50,y = 60var xin = true, yin = truevar step = 1var delay = 1var obj=document.getElementById("ad")function floatAD() {var L=T=0var R= document.body.clientWidth-obj.offsetWidthvar B = document.body.clientHeight-obj.offsetHeightobj.style.left = x + document.body.scrollLeftobj.style.top = y + document.body.scrollTopx = 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>星 11.5.6 14:49:09<a href="这里填你要连接到的网页地址" target="_blank"><img src="这个引号中间填图片路径" >你改这里就可以了,这个是会自动飘的那种`星 11.5.6 14:51:57至于昨天那个,你改这里var a = new xWin("1",160,200,200,200,"标题","<a href=这里填你要连接到的网页地址 target=_blank><img src=这个引号中间填图片路径></a>");星 11.5.6 15:11:57刚才发的那个浮动的有错,关闭不了.我发多一次`星 11.5.6 15:12:44<script type="text/javascript">function hidead(){document.getElementById("ad").style.display="none";}</script><div id="ad" style="position:absolute"><a><a href="这里填要连接的网址"><img src="这里填图片路径" border="0"></a></a><DIV onClick="hidead();" style="FONT-SIZE: 9pt; CURSOR: hand" align=r ight>关闭×</DIV></div><p><script>var x = 50,y = 60var xin = true, yin = truevar step = 1var delay = 1var obj=document.getElementById("ad")function floatAD() {var L=T=0var R= document.body.clientWidth-obj.offsetWidthvar B = document.body.clientHeight-obj.offsetHeightobj.style.left = x + document.body.scrollLeftobj.style.top = y + document.body.scrollTopx = 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>星 11.5.6 15:14:56<script type="text/javascript">function hidead(){document.getElementById("ad").style.display="none";}</script><div id="ad" style="position:absolute"><a href="这里填要连接的网址" target="_blank"><img src="这里填图片路径" border="0"></a><DIV onClick="hidead();" style="FONT-SIZE: 9pt; CURSOR: hand" align=r ight>关闭×</DIV></div><script>var x = 50,y = 60还是有点问题,把最上面几行改成这个`。
常用网页漂浮广告代码
常用网页漂浮广告代码<body bgcolor="#F7F7F7"><!--图片漂浮广告代码开始--><div id="www_qpsh_com" style="position:absolute"><!--链接地址--><a href="" target="_blank"><!--图片地址--><img src="/images/logo.jpg" border="0"></a></div><script>var x = 50,y = 60var xin = true, yin = truevar step = 1var delay = 10var obj=document.getElementById("www_qpsh_com")function floatwww_qpsh_com() {var L=T=0//by var R= document.body.clientWidth-obj.offsetWidthvar B = document.body.clientHeight-obj.offsetHeightobj.style.left = x + document.body.scrollLeftobj.style.top = y + document.body.scrollTopx = 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("floatwww_qpsh_com()", delay)obj.onmouseover=function(){clearInterval(itl)}obj.onmouseout=function(){itl=setInterval("floatwww_qpsh_com()", delay)}</script><!--图片漂浮广告代码结束--></body>THANKS !!!致力为企业和个人提供合同协议,策划案计划书,学习课件等等打造全网一站式需求欢迎您的下载,资料仅供参考。
C++ Builder实现飘浮广告图片
C++ Builder实现飘浮广告图片网页上到处能见到飘浮广告,任意在窗口内移动,用C++ Builder也能实现,增添程序的色彩,原理很简单,就是不断改变对象的坐标,即Left和Top属性。
下面以飘浮的图片为例。
新建一个工程,窗口Name属性为Form1,窗口宽度Width设为500,高度Height 设为400。
在窗口中添加一个Timage(在Additional页下),Name属性默认为Image1,点击Image1的Piceure属性,加载一张图片。
再在窗口中添加一个TTimer,Name默认为Timer1,Interval值设为1,Enabled设为true。
首先包含头文件并定义变量:#include "math.h" //后面要用到浮点数绝对值bool j=true;int x,y,x1,y1,x2,y2;然后在FormCreate里初始化变量:void__fastcall TForm1::FormCreate(TObject *Sender){//漂浮图片参数初始化x1=Image1->Left;y1=Image1->Top;x2=random(500);//随机获得一个坐标y2=random(400);Form1->DoubleBuffered=true;//让图片移动时不闪烁}接下来定义两个函数:int gety(int x1,int x2,int y1,int y2,int x){float y;y=(x-x1)*(y2-y1)/(x2-x1)+y1;y=(int)y;return y;}//求直线方程的y值int xie(int x1,int x2,int y1,int y2){float xielv=fabs((y2-y1)/(x2-x1));return xielv>1?1:0;}//判断斜率是否大于1最后一步,双击Timer1,写下如下代码:void__fastcall TForm1::Timer1Timer(TObject *Sender)//控制飘浮图片的移动{if(j){x=x1;j=false;}int xl=xie(x1,x2,y1,y2);if(xl)//如果斜率大于1,x随着y的值变化而变化{y=y+(y2-y1)/abs(y2-y1);x=gety(y1,y2,x1,x2,y);}else//如果斜率小于1,y随着x的值变化而变化{x=x+(x2-x1)/abs(x2-x1);y=gety(x1,x2,y1,y2,x);}//如果图片移动到边界,则将此时的坐标给x1和y1if(x>500||y>400||x<0||y<0){ x1=x;y1=y;x2=random(500);//随机获得下一个点的坐标y2=random(400);j=true;}//如果图片还没有移动到边界,则改变图片的坐标,即移动图片else{Image1->Left=x;Image1->Top=y;}}。