有没有人来看看呀?代码是这样的:
<script language="javascript" type="text/javascript">
var headHeight = 22;var bodyHeight = 202;var objcount = 8;var step = 10;var moving = false;
function showme(obj1, obj2)//div,td
{
if (moving)//
return;
moving = true;
for(i=0;i<document.all.tags('td').length;i++)//遍历所有的td
if (document.all.tags('td')[i].className.indexOf('headtd') == 0)//如果td的class是headtd
document.all.tags('td')[i].className = 'headtd1';//那么就替换该class为headtd1
obj2.className = 'headtd2';//将传参td 该为headtd2
moveme(obj1);//移动div
}
function moveme(obj)
{
idnumber = parseInt(obj.id.substr(4));//得到div的标示,item1body 1就是标示
//alert(idnumber)
objtop = headHeight * (idnumber - 1);//离上面的高度为 (标示id-1)*头高
objbuttom = bodyHeight + headHeight * (idnumber - 2);//离低面得距离为 整个body的高度+头高度*(标示id-2)
currenttop = parseInt(obj.style.top);//当前离上面的距离为当前对象的样式top
if (currenttop >= objbuttom)
{
countid = 1;
for(i=0;i<document.all.tags('div').length;i++)
if (document.all.tags('div')[i].id == 'item'+countid+'body')
{
obj = document.all.tags('div')[i];
objtop = headHeight * (countid - 1);
if (countid == idnumber)
{
moveup(obj,objtop,false);
break;
}
else
moveup(obj,objtop,true);
countid++;
}
}
else if ((currenttop >= objtop) && (idnumber < objcount))
{
idnumber++;
countid = objcount;
for(i=document.all.tags('div').length-1;i>=0;i--)
if (document.all.tags('div')[i].id == 'item'+countid+'body')
{
obj = document.all.tags('div')[i];
objbuttom = bodyHeight + headHeight * (countid - 2);
if (countid == idnumber)
{
movedown(obj,objbuttom,false);
break;
}
else
movedown(obj,objbuttom,true);
countid--;
}
}
}
function moveup(obj,objtop,ismove)
{
currenttop = parseInt(obj.style.top);
if (currenttop > objtop)
{
obj.style.top = currenttop - step;
setTimeout('moveup('+obj.id+','+objtop+','+ismove+')',1)
return;
}
moving = ismove;
}
function movedown(obj,objbuttom,ismove)
{
currenttop = parseInt(obj.style.top);
//alert(currenttop)
//alert("bbbbbbb")
if (currenttop < objbuttom)
{
obj.style.top = currenttop + step;
setTimeout('movedown('+obj.id+','+objbuttom+','+ismove+')',1)
return;
}
moving = ismove;
}
</script>
在firefox里点它没有反映呀?
<script language="javascript" type="text/javascript">
var headHeight = 22;var bodyHeight = 202;var objcount = 8;var step = 10;var moving = false;
function showme(obj1, obj2)//div,td
{
if (moving)//
return;
moving = true;
for(i=0;i<document.all.tags('td').length;i++)//遍历所有的td
if (document.all.tags('td')[i].className.indexOf('headtd') == 0)//如果td的class是headtd
document.all.tags('td')[i].className = 'headtd1';//那么就替换该class为headtd1
obj2.className = 'headtd2';//将传参td 该为headtd2
moveme(obj1);//移动div
}
function moveme(obj)
{
idnumber = parseInt(obj.id.substr(4));//得到div的标示,item1body 1就是标示
//alert(idnumber)
objtop = headHeight * (idnumber - 1);//离上面的高度为 (标示id-1)*头高
objbuttom = bodyHeight + headHeight * (idnumber - 2);//离低面得距离为 整个body的高度+头高度*(标示id-2)
currenttop = parseInt(obj.style.top);//当前离上面的距离为当前对象的样式top
if (currenttop >= objbuttom)
{
countid = 1;
for(i=0;i<document.all.tags('div').length;i++)
if (document.all.tags('div')[i].id == 'item'+countid+'body')
{
obj = document.all.tags('div')[i];
objtop = headHeight * (countid - 1);
if (countid == idnumber)
{
moveup(obj,objtop,false);
break;
}
else
moveup(obj,objtop,true);
countid++;
}
}
else if ((currenttop >= objtop) && (idnumber < objcount))
{
idnumber++;
countid = objcount;
for(i=document.all.tags('div').length-1;i>=0;i--)
if (document.all.tags('div')[i].id == 'item'+countid+'body')
{
obj = document.all.tags('div')[i];
objbuttom = bodyHeight + headHeight * (countid - 2);
if (countid == idnumber)
{
movedown(obj,objbuttom,false);
break;
}
else
movedown(obj,objbuttom,true);
countid--;
}
}
}
function moveup(obj,objtop,ismove)
{
currenttop = parseInt(obj.style.top);
if (currenttop > objtop)
{
obj.style.top = currenttop - step;
setTimeout('moveup('+obj.id+','+objtop+','+ismove+')',1)
return;
}
moving = ismove;
}
function movedown(obj,objbuttom,ismove)
{
currenttop = parseInt(obj.style.top);
//alert(currenttop)
//alert("bbbbbbb")
if (currenttop < objbuttom)
{
obj.style.top = currenttop + step;
setTimeout('movedown('+obj.id+','+objbuttom+','+ismove+')',1)
return;
}
moving = ismove;
}
</script>
在firefox里点它没有反映呀?
解决方案 »
- 求一个关于地址的正则表达式
- JQuery中是否有类似于asp.net中仅仅执行一次的函数
- 请问如何在通过标签显示的浏览器上也能弹出页面来?
- firefox2.0是共享同一个cookie问题
- 关于向服务端提交XML,AJAX和编码的问题,请有研究过这方面问题的朋友给些建议见。
- 请教: 当鼠标移至链接时, 如何显示该链接的预览(有答案加分结帐)
- 有下面代碼保存的.htm文件,在Chrome和IE10上報Uncaught ReferenceError:selYear is not defined,求解!
- 请教状态栏能永远显示同一个内容么?
- 简单问题--路径修正
- 模态窗口弹出两个的问题
- 时间在firefox里不出来
- 求:js 日期插件 支持 ie6 ie7 ie8 ff
可是我换成document.getElementsByName(“”)后在IE里也不行了?
是不是我写错了呀?我把document.all.tags(‘’)全部换成document.getElementsByName(“”)
谢谢呀?
如何给你分呀?
代码如下:
function Year_Month(){
var now = new Date();
var yy = now.getYear();
var mm = now.getMonth();
var mmm=new Array();
mmm[0]="1";
mmm[1]="2";
mmm[2]="3";
mmm[3]="4";
mmm[4]="5";
mmm[5]="6";
mmm[6]="7";
mmm[7]="8";
mmm[8]="9";
mmm[9]="10";
mmm[10]="11";
mmm[11]="12";
mmm=mmm[mm];
return(mm); }
function thisYear(){
var now = new Date();
var yy = now.getFullYear();
return(yy ); }
function Date_of_Today(){
var now = new Date();
return(now.getDate() ); }
function CurentTime(){
var now = new Date();
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
var clock = hh+':';
if (mm < 10) clock += '0';
clock += mm;
return(clock); }
function refreshCalendarClock(){
document.all.calendarClock1.innerHTML = Year_Month();
document.all.calendarClock2.innerHTML = Date_of_Today();
document.all.calendarClock3.innerHTML =thisYear();
document.all.calendarClock4.innerHTML = CurentTime(); }
document.write(' <div style="left:100px; bottom: 4px; position: absolute; text-align: center; z-index: 109" ForeColor="#ffffff">')
document.write(' <span style="color: #ffffff; font-family: 楷体;font-size:10px">')
document.write(' <font id="calendarClock1" color="#ffffff" > </font>/');
document.write(' <font id="calendarClock2" color="#ffffff"> </font>/');
document.write(' <font id="calendarClock3" color="#ffffff"> </font> ');
document.write(' <font id="calendarClock4" color="#ffffff"> </font>');
document.write(' </span>')
document.write(' </div>')
setInterval('refreshCalendarClock()',1000);
setInterval('callServer() ',1000);
同样在IE里行,在firefox里不行?
我换成document.getElementById()也不行?
谢谢呀?
document.all是IE专用!!!
但是我换成<span>,document.getElementById('calendarClock1').innerHTML = Year_Month(); 还是不行,看来是没法了?