兼容firefox 问这样的问题最好先准备一个基本的demo,方便修改调试,什么都要回答的人重头写也够累的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>显示div</title><script>function showDiv(o,id){ var o2 = document.getElementById(id); if(o2.style.display=="none") { o2.style.display=""; o.innerText = "隐藏DIV"; } else { o2.style.display="none"; o.innerHTML= "显示DIV"; }}</script></head><body><div onclick="showDiv(this,'div1')" style="cursor:hand">隐藏div</div><div id="div1">我被显示</div></body></html> style="cursor:hand"hand可以改成pointer 非常感谢。 在firefox下,显示div和隐藏div的切换好像有问题, <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><meta http-equiv="Content-Language" content="gb2312" /><title>DY CSS Layout</title><meta name="Author" content="Doyoe(飘零雾雨), [email protected]" /><script type="text/javascript">function display(){ var obj1 = document.getElementById("test"); obj1.style.display = (obj1.style.display == "none")?"block":"none";}</script></head><body><div><a id="dj" href="javascript:void(0);" onclick="display();">隐藏/显示</a></div><p id="test">我是大段的文字</p></body></html> Firefox 不支持 innerText / innerHTML 用javascript测试图片是否重合或是吻合 保存数据问题: Ext的获取焦点问题 心急如焚啊!!! 有关于iframe的问题 弹出窗口中(Popup)含有一个iframe,却不能显示内容,怎么回事 如何用onload加载htm的VML元数 ie6/7 层级出现问题 下拉框被遮住 jsp页面文本框获得焦点问题? JS高手进来看看啊 隐藏打开的窗口的问题!在线等! 刷流量的问题!!! JS效果! 有关拖动的
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示div</title>
<script>
function showDiv(o,id)
{ var o2 = document.getElementById(id);
if(o2.style.display=="none")
{
o2.style.display="";
o.innerText = "隐藏DIV";
}
else
{
o2.style.display="none";
o.innerHTML= "显示DIV";
}
}
</script>
</head><body>
<div onclick="showDiv(this,'div1')" style="cursor:hand">隐藏div</div>
<div id="div1">我被显示</div>
</body></html>
hand可以改成pointer
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<title>DY CSS Layout</title>
<meta name="Author" content="Doyoe(飘零雾雨), [email protected]" />
<script type="text/javascript">
function display(){
var obj1 = document.getElementById("test");
obj1.style.display = (obj1.style.display == "none")?"block":"none";
}
</script>
</head>
<body>
<div><a id="dj" href="javascript:void(0);" onclick="display();">隐藏/显示</a></div><p id="test">我是大段的文字</p>
</body>
</html>