日期:2014-05-17 浏览次数:20580 次
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language="javascript">
function controlRdo() {
var myRadios = document.getElementsByName("RadioButton1");
var theDate = new Date();
var s = "";
s = (theDate.getMonth() + 1);
if (s >= 9 || s <= 3) {
for (var i = 0; i < myRadios.length; i++) {
myRadios[i].style.display = "none";
myRadios[i].nextSibling.style.display = "none";
}
}
}
</script>
</head>
<body onload="controlRdo();">
<form id="form1" runat="server">
<div>
<asp:RadioButton ID="RadioButton1" runat="server" Text="男" />
</div>
</form>
</body>
</html>
------解决方案--------------------
楼上说的很对,结果是一样的,用什么方法不行呢
Page_Load
DateTime m = DateTime.Now;
int mon = m.Month;
if (mon > 9 || mon < 3)
{
RdoType6.Visible = false;
}
------解决方案--------------------
JS判断的是本地时间
建议在服务端用C#代码控制。