div中有一个背景图片,然后div绝对的,让后用js让层向上滚动时,为什么背景图片一直要刷新以下是js内容调用从btnMove开始;
<script language="javascript">
var time=null;
var moveDiv=null;
var moveHeight=30;
var clssNameNo=1;
function btnMove(messageNo){
if(time!=null){
clearTimeout(time);
}
// 初始化数据
moveDiv=document.getElementById("moveDiv");
//moveDiv.style.background="url(messageBG"+messageNo+".jpg)";
//moveDiv.style.backgroundRepeat="no-repeat";
moveDiv.style.display="block";
moveDiv.style.pixelTop=100+window.screenTop;
moveDiv.style.pixelLeft=(document.body.offsetWidth-moveDiv.offsetWidth)/2;
//moveDiv.className="a1";
moveHeight=30;
//moveDiv.style.backgroundPosition="0 30px";
clssNameNo=1;
startMove();
}
//开始移动
function startMove(){
if(time!=null){
clearTimeout(time);
}
moveDiv.style.pixelTop=moveDiv.style.pixelTop-2;
moveHeight=moveHeight-2;
time=setTimeout("startMove()",100);
if(moveHeight==0){
clearTimeout(time);
btnBeginMove();
}
}
//开始消失
function btnBeginMove(){
time=setTimeout("beginMove()",2000);
}
function beginMove(){
//moveDiv.style.backgroundPosition="0 -20px";
moveDiv.style.display="none";
}
</script>
<script language="javascript">
var time=null;
var moveDiv=null;
var moveHeight=30;
var clssNameNo=1;
function btnMove(messageNo){
if(time!=null){
clearTimeout(time);
}
// 初始化数据
moveDiv=document.getElementById("moveDiv");
//moveDiv.style.background="url(messageBG"+messageNo+".jpg)";
//moveDiv.style.backgroundRepeat="no-repeat";
moveDiv.style.display="block";
moveDiv.style.pixelTop=100+window.screenTop;
moveDiv.style.pixelLeft=(document.body.offsetWidth-moveDiv.offsetWidth)/2;
//moveDiv.className="a1";
moveHeight=30;
//moveDiv.style.backgroundPosition="0 30px";
clssNameNo=1;
startMove();
}
//开始移动
function startMove(){
if(time!=null){
clearTimeout(time);
}
moveDiv.style.pixelTop=moveDiv.style.pixelTop-2;
moveHeight=moveHeight-2;
time=setTimeout("startMove()",100);
if(moveHeight==0){
clearTimeout(time);
btnBeginMove();
}
}
//开始消失
function btnBeginMove(){
time=setTimeout("beginMove()",2000);
}
function beginMove(){
//moveDiv.style.backgroundPosition="0 -20px";
moveDiv.style.display="none";
}
</script>
解决方案 »
- jquery中获取table下的所有类型为text的input对象,谢谢
- 关于jq左右滑动效果
- 如何使用js删除上一级页面生成的cookie
- 请教关于脚本语言中的中文出错问题
- 请问JAVASCRIPT中连接SQLSERVER数据库的语句应该如何写?
- 求简单代码 JS实现图片特效 [没人回答第2次发]
- 怎样在WEB页面中调用服务器上的应用程序?
- 多页报表在打印时,如何实现每页的第一行都自动附加报表的表头
- 如何用falsh实现关机????或者用javascript写个关机函数??
- 请问onclick问题
- 求答案,高手请进!~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 怎样用JavaScript在网页中下雪
document.execCommand("BackgroundImageCache", false, true);
}
但如果是div怎么解决
img是html标签 不一样的