谁能帮我看看为什么效果不正确呀。。我加分。

来源:百度知道 编辑:UC知道 时间:2024/06/30 09:52:14
<html>
<head>
<script language="javascript">
var wind= window.open("http://www.baidu.com","baidu","wind=300,height=400,resizable=n);
wind.focus();
wind.moveTo(0,0);
var a=1;//纪录滚动的速度
var x=0;//滚动的坐标
var imgwind= 1024;
function start(){
if(x<=(imgwind-300){
x+=a;
wind.scrollTo(x,0)};
else{
x=0;}
setTimeout("start()",20);
}
</script>
</head>
<body>
<form>
<input type="button" value="开始滚动" onClick="start()">
</body>
</html>

<html>
<head>
<script language="javascript">
var wind= window.open("","baidu","width=300,height=400,resizable=no");
wind.focus();
wind.moveTo(0,0);
var a=1;//纪录滚动的速度
var x=0;//滚动的坐标
var imgwind= 1024;
function scrollstart(){
if(wind.closed)return;
if(x<=(imgwind-300)){
x+=a;
wind.scrollTo(x,0);//wind.moveTo(x,0);
}
else{x=0;}
setTimeout("scrollstart()",20);
}
</script>
</head>
<body>
<form>
<input type="button" value="开始滚动" onclick="scrollstart()">
</form>
</body>
</html>

javascript为了考虑安全性,打开新窗口时不能载入百度,除非上面的代码在百度服务器上运行。还有start()好象有问题,不知道为什么。