帮我看看这网页分辨率代码吧

来源:百度知道 编辑:UC知道 时间:2024/06/30 15:39:44
帮我看看这分辨率代码哪里错了.我刚学做网站不太懂所以问问错了没!!!
<html>
<head>
<script language="javascript">
function redirectpage()
{
var url640*480=640480.htm";
var url800*600="800600.htm";
var url1024768="1024768.htm";
if(screen.width==640 & screen.height==480)
{
window.location.href=url640*480;
}
else
{
if(screen.width==800 & screen.height==600)
{
window.location.href=url800*600;
}
else
{
if(screen.width==1024 & screen.height==768)
{
window.location.href=url1024*768;
}
else
{
window.location.href=url800*600;
}
}
}
}

你有很多命名不规范,还有if else的基础语法有问题
<html>
<head>
<script language="javascript">
function redirectpage()
{
var url640x480="640480.htm";
var url800x600="800600.htm";
var url1024x768="1024768.htm";
if(screen.width==640 & screen.height==480)
{
window.location.href=url640x480;
}
else if(screen.width==800 & screen.height==600)
{
window.location.href=url800x600;
}
else if(screen.width==1024 & screen.height==768)
{
window.location.href=url1024x768;
}
else {
window.location.href=url800x600;
}
}
window.onload=redirectpage;
</script>
</head>
<body>
处理中...
</body>
</html>