本文目录一览:
- 1、求一个页面上漂浮着两个浮动广告的js代码,就是左右两个类似春联的条形广告,能跟随着页面上下拉动
- 2、求JS代码,悬浮广告,停在网页右侧的!
- 3、求一个页面上漂浮着两个浮动广告的js代码
- 4、JS漂浮广告代码
- 5、网页浮动广告条js代码
求一个页面上漂浮着两个浮动广告的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);
求JS代码,悬浮广告,停在网页右侧的!
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTML
HEAD
TITLE New Document /TITLE
META NAME="Generator" CONTENT="EditPlus"
META NAME="Author" CONTENT=""
META NAME="Keywords" CONTENT=""
META NAME="Description" CONTENT=""
/HEAD
style
body{
background-color :#FFF; background-image :url(dialogclose.gif) ; background-repeat :no-repeat ; background-position: right bottom ;background-attachment:fixed;
}
/style
BODY
table
tr
td height="900"/td
/tr
/table
/BODY
/HTML
//这是停在右下角的 自己改图片路径
求一个页面上漂浮着两个浮动广告的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漂浮广告代码
给个简单的 也需引入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代码
我写了个简单的,自己根据具体情况修改吧
script
function
ddd()
{
//alert("ddd");
document.getelementbyid("chip1").style.top=document.body.scrolltop
+50;
document.getelementbyid("chip2").style.top=document.body.scrolltop+50;
}
/script
body
onscroll="ddd()"
bgcolor="#ffffff"
text="#000000"
div
id="chip1"
style="position:absolute;
width:100;
height:400;left:0px;top:50px;background:#00dd00;"
a
href="rm/ad1.htm"img
src="
"
border=0/a
/div
div
id="chip2"
style="position:absolute;
width:100;
height:400;left:1000px;top:50px;background:#00dd00;"
a
href="rm/ad2.htm"img
src="
"
border=0/a
/div
center
p
p
p
p
p
dd
p
dd
p
p
dd
p
p
dd
p
p
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
dd
p
p
p
dd
p
p
dd
p
p
dd
p
p
p
p
p
/center
/body