以下代码不能兼容高速浏览器,麻烦高手帮帮忙,感谢大家指点一下.
<script language="javascript"> function show(str,strs)
{
if (document.getElementById(str).checked==true)
{document.getElementById(strs).style.display="block";}
else
{document.getElementById(strs).style.display="none";}
}function jumpwindow(i){
document.all.bodyly.style.display="block";
document.all.bodyly.style.width=document.body.clientWidth+"px";
document.all.bodyly.style.height=document.body.clientHeight+"px";
document.getElementById("jumply"+i).style.display='block';
document.getElementById("jumply"+i).style.top=(document.documentElement.scrollTop+40)+"px";
document.getElementById("jumply"+i).style.left=(document.body.clientWidth/2-250)+"px";
}
function unwindow(i){
document.getElementById("jumply"+i).style.display='none';
document.all.bodyly.style.display="none";
} </script>
<script language="javascript"> function show(str,strs)
{
if (document.getElementById(str).checked==true)
{document.getElementById(strs).style.display="block";}
else
{document.getElementById(strs).style.display="none";}
}function jumpwindow(i){
document.all.bodyly.style.display="block";
document.all.bodyly.style.width=document.body.clientWidth+"px";
document.all.bodyly.style.height=document.body.clientHeight+"px";
document.getElementById("jumply"+i).style.display='block';
document.getElementById("jumply"+i).style.top=(document.documentElement.scrollTop+40)+"px";
document.getElementById("jumply"+i).style.left=(document.body.clientWidth/2-250)+"px";
}
function unwindow(i){
document.getElementById("jumply"+i).style.display='none';
document.all.bodyly.style.display="none";
} </script>
解决方案 »
- 新手求助 json的数组怎么使用变量?
- 我在网上下的,为什么运行不出来,html,head,body标签是我自己加上的,是标签我加错了位置吗
- 求 js 带倒计时的对话框
- 菜鸟急问:div层的z-index是一个什么数据格式?
- 如何用JS 编写一个 当用户输入字母时 将小写自动转成大写
- 一个简单的文本框value问题?
- 两种写法到底有什么不同的意思?
- 现在javascript还流行吗?现在有没有必要学?
- 等待高手,关于iframe,在线。
- 怎样才能让textarea不能编辑,即变灰,在线立马给分?
- Javascript和CSS浏览器兼容总结
- 怎么把div中的内容显示在EXT panel中的html中
改成:
document.getElementById("bodyly").style.display="block";
这个是IE独有的东东,你直接用它来获取元素,基本上不是说兼容的问题了,而是所有非IE标准浏览器都无法实现
{
if (document.getElementById(str).checked==true)
{document.getElementById(strs).style.display="block";}
else
{document.getElementById(strs).style.display="none";}
}
应该是这段代码需要调整.
主要按钮点击无法展开隐藏的内容.
<input type="checkbox" name="education" id="education" value="1" onclick="javascript:show('education','educationcon');" />这个是按钮代码.所有代码在IE6都是正常能用的.
if(document.all){
alert(1)
}else{
alert(2)
}
拿着上面的代码,在IE和非IE下试试去,看看是什么效果。你不信我们的么有关系的,眼见为实吧,事实总能说明情况了吧?
我一般有需要的时候都直接拿document.all去区分是不是IE浏览器了
{
if (document.getElementById(str).checked==true)
{document.getElementById(strs).style.display="block";}
else
{document.getElementById(strs).style.display="none";}
}
<!--
if (document.getElementById("education").checked==true)
{
if (fnRemoveBrank(theForm.edu_start_year.value) == "0")
{
alert("请选择");
theForm.edu_start_year.focus();
return (false);
}
if (fnRemoveBrank(theForm.edu_edu.value) == "")
{
alert("请选择学历!");
theForm.edu_edu.focus();
return (false);
}
}
function jumpwindow(i){
document.getElementById("bodyly").style.display="block";
document.getElementById("bodyly").style.width=document.body.clientWidth+"px";
document.getElementById("bodyly").style.height=document.body.clientHeight+"px";
document.getElementById("jumply"+i).style.display='block';
document.getElementById("jumply"+i).style.top=(document.documentElement.scrollTop+40)+"px";
document.getElementById("jumply"+i).style.left=(document.body.clientWidth/2-250)+"px";
}
function unwindow(i){
document.getElementById("jumply"+i).style.display='none';
document.getElementById("bodyly").style.display='none';
}
-->
</script>
<input type="checkbox" name="education" id="education" value="1" onclick="javascript:show('education','educationcon');" />这个是按钮代码.
在ie下都能正常运行,其它的浏览器就是(点击按钮不能展开内容)主要是这个问题!