我写了一段代码,用来显示和隐藏某界面,可是IE和Chrome中表现正常,在Firefox中表现不正常。以下是Default.aspx中的源码,各位高手指导一下吧~~
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
body{ background:#FFF; margin:0; padding:0; text-align:center; overflow:auto;}
#main{ margin:0 auto; width:1031px; }
.icss{ border:0; margin:0; padding:0; background:#000000; color:#FFFFFF; font-size:12px; visibility:visible;
z-index:10; top:0; left:0; position:absolute; -moz-opacity:.7; opacity:0.7; filter:alpha(opacity=70);
height: 100%; width: 100%; }
</style>
<script language="javascript" type="text/javascript">
function BeHidden(m) {
alert("FF不显示这里");
m.style.visibility = "hidden";
}
function BeVisible(m) {
m.style.visibility = "visible";
}
</script>
</head><body class="bodycss" scroll="no" style=" height:100%; overflow:auto;">
<form id="form1" runat="server">
<div id="ip" class="icss" >
<div style=" margin:0 auto; margin-top:20%; padding:5px; width:160px; background:#000FFF; z-index:20;">
<br /><span id="iptitle" style=" font-size: 14px; font-weight:bolder; font-family:微软雅黑,黑体;"></span>
<br /><a id="iptext"></a><br />
<input id="ButtonSbm" type="button" value="确 定"
onclick="alert('FF可以执行这里');BeHidden(ip);return false;" /><br />
</div>
</div>
<div id="page" style="overflow:scroll; position:fixed; top:0px; left:0; bottom:0px; right:0;">
<div id="main">
<input id="Button1" type="button" value="确 定" onclick="return BeVisible(ip)" />
</div>
</div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
body{ background:#FFF; margin:0; padding:0; text-align:center; overflow:auto;}
#main{ margin:0 auto; width:1031px; }
.icss{ border:0; margin:0; padding:0; background:#000000; color:#FFFFFF; font-size:12px; visibility:visible;
z-index:10; top:0; left:0; position:absolute; -moz-opacity:.7; opacity:0.7; filter:alpha(opacity=70);
height: 100%; width: 100%; }
</style>
<script language="javascript" type="text/javascript">
function BeHidden(m) {
alert("FF不显示这里");
m.style.visibility = "hidden";
}
function BeVisible(m) {
m.style.visibility = "visible";
}
</script>
</head><body class="bodycss" scroll="no" style=" height:100%; overflow:auto;">
<form id="form1" runat="server">
<div id="ip" class="icss" >
<div style=" margin:0 auto; margin-top:20%; padding:5px; width:160px; background:#000FFF; z-index:20;">
<br /><span id="iptitle" style=" font-size: 14px; font-weight:bolder; font-family:微软雅黑,黑体;"></span>
<br /><a id="iptext"></a><br />
<input id="ButtonSbm" type="button" value="确 定"
onclick="alert('FF可以执行这里');BeHidden(ip);return false;" /><br />
</div>
</div>
<div id="page" style="overflow:scroll; position:fixed; top:0px; left:0; bottom:0px; right:0;">
<div id="main">
<input id="Button1" type="button" value="确 定" onclick="return BeVisible(ip)" />
</div>
</div>
</form>
</body>
</html>
m.style.display= "block";
function BeHidden(m) {
alert("FF不显示这里");
m.style.visibility = "hidden";
} <input id="ButtonSbm" type="button" value="确 定"
onclick="alert('FF可以执行这里');BeHidden(ip);return false;" /><br />改为 function BeHidden(m) {
var id = m;
document.getElementById(id).style.visibility = "hidden";
} <input id="ButtonSbm" type="button" value="确 定"
onclick="alert('FF可以执行这里');BeHidden('ip');return false;" /><br />就可以兼容FF了~~感觉好像FF必须要通过''来传递变量……就像alert()在IE和Chrome中都可以弹出没有提示的对话框,FF直接不会弹出对话框……