一个JAVASCRIPT函数 1.我知道分辨率是有系统参数的, 不过我不知道是什么:)2.换一个判断方式ru: screen.width < 1024 --说明是 800 的或者更低:)//不知道行不行 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你分辨率判断是正确的--我试过了class_name是什么东西啊? <script>function bg_screen(class_name,bg_path,lbg_path) { if ((screen.width == 800) && (screen.height == 600)) { //aa.className = "bodybg2"; document.getElementById(class_name).style.backgroundColor = bg_path; } else if ((screen.width == 1024) && (screen.height == 768)) { //aa.className = "bodybg1"; document.getElementById(class_name).style.backgroundColor = lbg_path; } }</script> "aa"是字符串同意楼上document.getElementById <script language="javascript"><!-- //根据分辨率改变背景图 function bg_screen(class_name,bg_path,lbg_path) { if ((screen.width == 800) && (screen.height == 600)) { //aa.className = "bodybg2"; class_name.background = bg_path; } else if ((screen.width == 1024) && (screen.height == 768)) { //aa.className = "bodybg1"; class_name.background = lbg_path; } }//--></script><body id=bodybg1 onload=bg_screen(bodybg1,"image/155863.jpg","image/107198.gif") ></body> 晕倒,<script>function bg_screen(class_name,bg_path,lbg_path) { if ((screen.width == 800) && (screen.height == 600)) { //aa.className = "bodybg2"; document.getElementById(class_name).style.background = bg_path; } else if ((screen.width == 1024) && (screen.height == 768)) { //aa.className = "bodybg1"; document.getElementById(class_name).style.background = lbg_path; } }</script>这个程序在具体运行的时候提示参数无效 关于加载顺序 在Html5中怎么通过JavaScript创建并写入文件?? Jsp中两个select的联动问题及值传递 使用Extjs的ToolTip控件~需要触发两次才会弹出信息框!!! 急~!!! 关于div+css布局问题?、 js不能对文件进行读写 js $ 符号的意思 如何把事件写到脚本里 升星了,也来说几句! 如何给带参数的IMG src做变量 小弟是新手,如何用js编写这样的日期代码? 小弟想学习一下别人的JS,可是打开后发现没有换行,密密麻麻一大坨,请问怎么才能让他自动显示出缩进。
class_name是什么东西啊?
function bg_screen(class_name,bg_path,lbg_path) {
if ((screen.width == 800) && (screen.height == 600)) {
//aa.className = "bodybg2";
document.getElementById(class_name).style.backgroundColor = bg_path;
} else if ((screen.width == 1024) && (screen.height == 768)) {
//aa.className = "bodybg1"; document.getElementById(class_name).style.backgroundColor = lbg_path;
}
}</script>
同意楼上document.getElementById
<!--
//根据分辨率改变背景图
function bg_screen(class_name,bg_path,lbg_path)
{
if ((screen.width == 800) && (screen.height == 600)) {
//aa.className = "bodybg2";
class_name.background = bg_path;
}
else if ((screen.width == 1024) && (screen.height == 768)) {
//aa.className = "bodybg1";
class_name.background = lbg_path;
}
}//-->
</script><body id=bodybg1 onload=bg_screen(bodybg1,"image/155863.jpg","image/107198.gif") ></body>
function bg_screen(class_name,bg_path,lbg_path) {
if ((screen.width == 800) && (screen.height == 600)) {
//aa.className = "bodybg2";
document.getElementById(class_name).style.background = bg_path;
} else if ((screen.width == 1024) && (screen.height == 768)) {
//aa.className = "bodybg1"; document.getElementById(class_name).style.background = lbg_path;
}
}</script>
这个程序在具体运行的时候提示参数无效