一个ASP简单问题

来源:百度知道 编辑:UC知道 时间:2024/05/24 12:05:13
我作了一个页面 有一个大的背景图片
<style type="text/css">
<!--
body {
background-image: url(images/bg.jpg);
}
-->
</style>

这个背景图片是按1024*768模式作的 在800*600下显示不美观

我的想法是用程序控制一下 如果1024模式就显示背景 不是1024就不显示背景

程序怎么写 谢谢啊

等等,我写段东西给你.

<script>
if (screen.width == 1024)
//显示背景
else
//不显示背静
</script>

无法获取客户端的分辨率啊!
应该没有办法,,,我找找看哦!

<script>
width = screen.width;
height = screen.height;

……

</script>

接上面zhujunabc的答案

var obj=document.getElementsByTag("body");
if (width==800 && height==600)
{
obj.style.background="";
}

根据你的要求写了下面的一段程序。
经过测试,运行成功,方才提交。
希望对你有所帮助。
根据下面的格式写你的网页程序
<script>
if (window.screen.width==1024)
{
document.write("<BODY BACKGROUND='图片地址'>");
}
else
{
document.write("<BODY>");
}
</script>
其它内容
</body>