日期:2014-05-16  浏览次数:20397 次

两个<script>标签在同一index.aspx里冲突,哪位高手帮忙解决一下,非常感谢!
第一个:
<!--文字从下往上滚动-->
<script>
var timeScroll= false;

window.onload = function() {
 dMarquee('scroll',timeScroll);
}

function dMarquee(id,timer){
 var speed=30; //速度
 var stop=2000; //停止时间 

 var ul = document.getElementById(id);
 var rows=ul.getElementsByTagName('li').length;
 var height = ul.getElementsByTagName('li')[0].offsetHeight;

 ul.innerHTML += ul.innerHTML;
 var contain=ul.innerHTML;
 
 var play = function() {
  ul.scrollTop++;

  if(ul.scrollTop==rows*height){
  ul.scrollTop=0;
  }

  if(ul.scrollTop%height==0) {
  timer = setTimeout(play,stop);
  }else{
  timer = setTimeout(play,speed);
  } 
 }

 timer = setTimeout(play,stop);

 ul.onmouseover = function() {clearTimeout(timer);}
 ul.onmouseout = play;
} </script>


第二个:
<SCRIPT language=javascript>
客服果果=function (id,_top,_left){
var me=id.charAt?document.getElementById(id):id, d1=document.body, d2=document.documentElement;
d1.style.height=d2.style.height='100%';me.style.top=_top?_top+'px':0;me.style.left=_left+"px";//[(_left>0?'left':'left')]=_left?Math.abs(_left)+'px':0;
me.style.position='absolute';
setInterval(function (){me.style.top=parseInt(me.style.top)+(Math.max(d1.scrollTop,d2.scrollTop)+_top-parseInt(me.style.top))*0.1+'px';},10+parseInt(Math.random()*20));
return arguments.callee;
};
window.onload=function (){
客服果果
('xixi',100,-152)
}
</SCRIPT>

<SCRIPT language=javascript> 
lastScrollY=0; 

var InterTime = 1;
var maxWidth=-1;
var minWidth=-152;
var numInter = 8;

var BigInter ;
var SmallInter ;

var o = document.getElementById("xixi");
var i = parseInt(o.style.left);
function Big()
{
if(parseInt(o.style.left)<maxWidth)
{
i = parseInt(o.style.left);
i += numInter;
o.style.left=i+"px";
if(i==maxWidth)
clearInterval(BigInter);
}
}
function toBig()
{
clearInterval(SmallInter);
clearInterval(BigInter);
BigInter = setInterval(Big,InterTime);
}
function Small()
{
if(parseInt(o.style.left)>minWidth)
{
i = parseInt(o.style.left);
i -= numInter;
o.style.left=i+"px";

if(i==minWidth)
clearInterval(SmallInter);
}
}
function toSmall()
{
clearInterval(SmallInter);
clearInterval(BigInter);
SmallInter = setInterval(Small,InterTime);

}

</SCRIPT>

------解决方案--------------------
把两个window.onload=function(){}里面的内容放到一个里面去