keil mdk5安装教程:步停滚动延时效果怎么做?

来源:百度文库 编辑:高校问答 时间:2024/05/03 05:59:39
就像这样的http://www.scrw.cn/inc/rush.asp
问题是我在单独的页面中做出来可以
但是我用服务器端包含进另一页面时就不行了?
我的代码是这样的(sh.asp中):
<SCRIPT LANGUAGE="JavaScript">
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
pf.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = pf.offsetHeight;
Woffset = pf.offsetWidth;
pf.style.left = xPos + document.body.scrollLeft;
pf.style.top = yPos + document.body.scrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
}
function start() {
pf.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
</script>

<span id=icefable1>
<img src="img/a.gif">
</span>

<SCRIPT>
marqueesHeight=125;
stopscroll=false;
with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=0; currentTop=125; stoptime=0;
icefable1.innerHTML+=icefable1.innerHTML;

function init_srolltext(){
icefable1.scrollTop=0;
setInterval("scrollUp()",10);
}
init_srolltext();

function scrollUp(){
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==127)
{
stoptime+=1;
currentTop-=1;
if(stoptime==800)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollTop;
icefable1.scrollTop+=1;
if(preTop==icefable1.scrollTop){
icefable1.scrollTop=125;
icefable1.scrollTop+=1;

}
}

}
</SCRIPT>
在主页中引用:

<!--#include file="sh.asp"-->
这样就不动了,而且出现两行相同的图片!