|
藍森林 http://www.lslnet.com 2006年8月25日 8:28
網頁不斷可以向下拉,要怎麼解決~
[size=5][color=Red]二樓的選運行代碼看看再說是不是無聊[/color][/size]
這個頁面不斷可以向下拉,沒有底~怎麼解決??
[html]<SCRIPT FOR='xuangua' EVENT='fscommand()' LANGUAGE='JavaScript'>
AdLayer1.style.visibility='hidden';
AdLayer2.style.visibility='hidden';
AdLayer3.style.visibility='hidden';
AdLayer4.style.visibility='hidden';
</script>
<script LANGUAGE='JavaScript'>
function initEcAd() {
document.all.AdLayer1.style.posTop = -300;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -300;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
document.all.AdLayer3.style.posTop = -300;
document.all.AdLayer3.style.visibility = 'visible'
document.all.AdLayer4.style.posTop = -300;
document.all.AdLayer4.style.visibility = 'visible'
MoveLeftLayer3('AdLayer3');
MoveRightLayer4('AdLayer4');
}
function MoveLeftLayer(layerName) {
var x = 5;//
var y =50;//
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 = y");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;//
var y = 50;//
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);
}
function MoveLeftLayer3(layerName) {
var x = 5;
var y = 400;
var diff = (document.body.scrollTop + y - document.all.AdLayer3.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer3('AdLayer3');", 20);
}
function MoveRightLayer4(layerName) {
var x = 5;
var y = 400;
var diff = (document.body.scrollTop + y - document.all.AdLayer4.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("MoveRightLayer4('AdLayer4');", 20);
}
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><EMBED src='http://ad4.sina.com.cn/200510/11/33121.swf' quality=high WIDTH=100 HEIGHT=400 TYPE='application/x-shockwave-flash' id=xuangua></EMBED></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><EMBED src='http://ad4.sina.com.cn/200510/11/33121.swf' quality=high WIDTH=100 HEIGHT=400 TYPE='application/x-shockwave-flash' id=xuangua></EMBED></div>");
document.write("<div id=AdLayer3 style='position: absolute;visibility:hidden;z-index:1'><EMBED src='http://ad4.sina.com.cn/200510/11/33121.swf' quality=high WIDTH=100 HEIGHT=400 TYPE='application/x-shockwave-flash' id=xuangua></EMBED></div>"
+"<div id=AdLayer4 style='position: absolute;visibility:hidden;z-index:1'><EMBED src='http://ad4.sina.com.cn/200510/11/33121.swf' quality=high WIDTH=100 HEIGHT=400 TYPE='application/x-shockwave-flash' id=xuangua></EMBED></div>");
initEcAd()
</script>
<style type="text/css">
<!--
.style2 {font-size: 222}
-->
</style>
<body>
<div align="center">b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
<span class="style2">怎麼搞</span><br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
b<br >
</div>
</body>
[/html] |
LZ你好無聊哦~ |
二樓的高手,我的貼是不是得罪了你呀~如果是,我說聲對不起~~
上面的我不知道要怎麼控制它,
使它不可以不斷向下拉~你這個高手幫幫我,
如果什麼人都會,那我這貼就算無聊了~~ |
二樓的可能不知你問什麼且而,我也有同樣的問題 |
頁面加載完成以後,用一個變量存儲document.body.scrollHeight
在MoveLeftLayer、MoveRightLayer等等裡面加入判斷,若移動層位置會導致document.body.scrollHeight大於初始值,則不執行該操作
只給個思路,具體代碼不自己去解決吧
——我個人特別討厭那種懸掛的或者滿天飛的層,品位低下,毫無美感可言,並且非常占系統資源,一點都不為用戶著想,技術含量又不過如此——看看樓主貼出來的那些代碼(當非樓主親筆),混亂而且囉嗦,說是垃圾一點都不過分。 |
多謝mozart0的思路,我本人也認為這些層無用,可以
老闆要這樣的廣告,可以不嗎~老闆只為自己著想,現在電腦那麼強了,不用為用戶著想了吧~為用戶著想就不用做flash網站了~
我看過很多對聯的廣告代碼了,很多很複雜的~
這個算好簡單了
這代碼不是我親筆,都是抄抄改改的~(有問題嗎?)
自己會寫就不用問你這個簡單問題了~ |
marvellous
的代碼:
[html]
<script language="javascript">
function showtime(){
currtime.innerText=new Date().toLocaleString();
setTimeout("showtime()",1000)
}
window.attachEvent("onload",showtime)
</script>
<html>
<body>
<script language="JavaScript">
var delta=0.15
var 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)+'">'+content+'</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.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width<=800)
{
for(var i=0;i<collection.length;i++)
{
collection[i].object.style.display = 'none';
}
return;
}
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)) {
var dx=(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)) {
var dy=(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();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<br><EMBED src="http://ad4.sina.com.cn/200411/02/4274_100.swf" id="veicon" quality=high PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" WIDTH="100" HEIGHT="300"></EMBED>');
theFloaters.addItem('followDiv2',6,80,'<br><EMBED src="http://ad4.sina.com.cn/200411/02/4274_100.swf" id="veicon" quality=high PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" WIDTH="100" HEIGHT="300"></EMBED>');
theFloaters.play();
</script>
<SCRIPT FOR='veicon' EVENT='FSCommand()' LANGUAGE='JavaScript'>
followDiv1.style.visibility='hidden';
followDiv2.style.visibility='hidden';
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
[/html] |
|