永发信息网

js兼容问题,希望高手能帮我解决一下,谢谢!

答案:1  悬赏:50  手机版
解决时间 2021-08-23 17:50

这段代码能兼容I8不能兼容火狐和其他浏览器,这是为什么了?
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>
<style type="text/css">
<!--
a:link {
 text-decoration: none;
}
a:visited {
 text-decoration: none;
}
a:hover {
 text-decoration: none;
}
a:active {
 text-decoration: none;
}
.STYLE1 {
 font-family: "创艺简老宋";
 font-size: 20px;
 color: #FFFF00;
}
.STYLE2 {
 font-family: "创艺简老宋";
 font-size: 20px;
 color: #FF0000;
}
.STYLE3 {
 font-family: "创艺简老宋";
 font-size: 20px;
 color: #00CC33;
}
.STYLE4 {
 font-family: "创艺简老宋";
 font-size: 20px;
 color: #FFFFFF;
}
#Layer1 {
 position:absolute;
 left:275px;
 top:93px;
 width:164px;
 height:167px;
 z-index:1;
}
body {
 background-image: url(../qiep/zb14.jpg);
}
-->
</style>
<SCRIPT>
function ow(obj) {
    URL=obj.href;
    width=268;
    height=530;
    var left = ( screen.width - width ) / 2;
    var top = ( screen.height - height ) / 2;
    window.open(URL,'','width=268,height=530,top='+top+',left='+left+',scrollbars=0,resizable=0');
    return false;
}

</SCRIPT>
</head>

<body>
<DIV id=marquees>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p class="STYLE3">&nbsp;&nbsp;</p>
  <p class="STYLE3">&nbsp;</p>
  <p class="STYLE3">&nbsp;</p>
  <p class="STYLE3">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; 以下信息每天更新20条!</p>
  <p><A href="n_468.htm" target="_blank" onClick="return ow(this)">&nbsp;</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="STYLE2">信息真实敬请留意</span></p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p><A href="n_468.htm" target="_blank" onClick="return ow(this)"> &nbsp; &nbsp;</A><img src="../zp/zpt/1.jpg" width="260" height="140"><br />
    <br />
  &nbsp;&nbsp; <BR>
    <BR>
    <A
href="javascript:">&nbsp;&nbsp;</A><img src="../zp/zpt/2.jpg" width="260" height="180"><br />
    <br />
  &nbsp;&nbsp; <br />
  &nbsp;&nbsp;<img src="../zp/zpt/3.jpg" width="260" height="180"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/4.jpg" width="260" height="310"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/5.jpg" width="260" height="239"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/6.jpg" width="259" height="253"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/7.jpg" width="265" height="386"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/8.jpg" width="260" height="305"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/9.jpg" width="260" height="287"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/10.jpg" width="260" height="236"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/11.jpg" width="260" height="189"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/12.jpg" width="260" height="161"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/13.jpg" width="260" height="195"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/14.jpg" width="260" height="385"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/15.jpg" width="260" height="434"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/16.jpg" width="260" height="171"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/17.jpg" width="260" height="159"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/18.jpg" width="260" height="250"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/19.jpg" width="260" height="198"><br />
    <br />
    <br />
  &nbsp;&nbsp;<img src="../zp/zpt/20.jpg" width="260" height="197"><BR>
    <BR>
  </p>
</DIV>
<SCRIPT language=JavaScript>

marqueesHeight=440;
stopscroll=false;

with(marquees){
  style.width=0;
  style.height=marqueesHeight;
  style.overflowX="visible";
  style.overflowY="hidden";
  noWrap=true;
  onmouseover=new Function("stopscroll=true");
  onmouseout=new Function("stopscroll=false");
}
document.write('<div id="templayer" ></div>');

preTop=0; currentTop=0;

function init(){
  templayer.innerHTML="";
  while(templayer.offsetHeight<marqueesHeight){
    templayer.innerHTML+=marquees.innerHTML;
  }
  marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
  setInterval("scrollUp()",30);//越大越慢
}
document.body.onload=init;

function scrollUp(){
  if(stopscroll==true) return;
  preTop=marquees.scrollTop;
  marquees.scrollTop+=1;
  if(preTop==marquees.scrollTop){
    marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
    marquees.scrollTop+=1;
  }
}
</SCRIPT>
</body>
</html>

最佳答案

其实图片滚动不用写那么复杂的,给你看个简单的例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
a img{
 border:none;
}
#content ul,#content2 ul{
 margin:0px;
 padding:0px;
 list-style-type:none;
}
#content ul li,#content2 ul li{
 margin:0px;
 padding:0px;
 list-style-type:none;
}
</style>
</head>


<body>
<div id="container" >


<div id="content">


<ul>
 <li>以下信息每天更新20条!</li>
 <li>信息真实敬请留意</li>
<li><a href="#"><img src=" http://img1.qq.com/www/pics/816/816587.gif" /></a></li>
<li><a href="#"><img src=" http://img1.qq.com/www/pics/6743/6743671.jpg" /></a></li>
<li><a href="#"><img src=" http://mat1.qq.com/www/images/ind36.gif" /></a></li>
<li><a href="#"><img src=" http://mat1.qq.com/www/images/200709/home_b.gif" /></a></li>
<li><a href="#"><img src=" http://mat1.qq.com/www/images/allskin/wmlogo.gif" /></a></li>
</ul>
</div>
<div id="content2"></div>
</div>
<script type="text/javascript">
var speed=40;
var content=document.getElementById("content");
var content2=document.getElementById("content2");
var container=document.getElementById("container");
content2.innerHTML=content.innerHTML;
function Marquee()
{
    if(content2.offsetTop-content.scrollTop<=0)
    content.scrollTop-=content1.offsetHeight;
    else
    container.scrollTop++;


}
var scrollcnt=setInterval(Marquee,speed);
container.onmouseover=function() {
    clearInterval(scrollcnt);
    }
container.onmouseout=function() {
    scrollcnt=setInterval(Marquee,speed);
}
</script>
</body>
</html>

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
汝州市平顶山靓丽永康美容院地址在什么地方,
脸上不时的长黑痣,是什么原因?
春秋q传镜湖在哪
桃源县常德桃源县黄婆店卫生院怎么去啊,谁知
诺基亚E66手机无法上网
洛克人8好玩么,好过么
身高158体重100斤会是什么样子呀!有图进来。
手背被猫抓几个小伤口,不大,注意是抓的,用
注册表子键Windows Metrics是用来管理什么的?
黄陂区武汉红星村卫生室在哪里啊,我有事要去
我有一个QQ号,的农场和牧场为什么都不能玩呢
地下城同一QQ号的两个人物怎样相互给东西
天门市天门口口香面王怎么去啊,谁知道地址啊
曾轶可帅还是田原帅?
要下载电影致手机,在电脑上什么网站下载还是
推荐资讯
街头篮球里SF怎样能最快AWA?
丹江口市十堰未来星美术培训哪位知道具体地址
为什么我的QQ资料,年龄显示2010?
languages.exe是什么,哪里能下载有什么用?
现在100RMB能换多少韩币
w910i滑动时有卡卡声,是什么问题啊?
半生感悟名句,写一句关于感悟生命之深的名言
资阳区益阳巿资阳区卓越联通营业厅在什么地方
新乡县新乡艳阳春艺术馆地址在哪,我要去那里
快男中喜欢陈翔滴人最多吧.........
新买的助力车不怎么会开?有什么方法能速成吗
禹王台区开封小天使童装童鞋地址是什么,有没
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?