<select name="month" onchange="On_Month()"></select>
<scrript>
function On_Month() {
var Year = document.when.year.value;
if (Year.length == 4) {
Selected_Month = document.when.month.selectedIndex;
Selected_Year = Year;
Make_Calendar(Selected_Year, Selected_Month);
}
}
</script>这个document.when.year.value在HTML里是能运行的,但是放到c#前台里就不认识了,就无法获取year的值
document.when是什么东西?为什么HTML里能运行?C#里就不行了呢?
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<table width="170" border="1" cellspacing="0" cellpadding="0">
<form name="when">
<tr>
<td align="center">
<div id="NavBar" style="position: relative; top: -1px;">
<select name="month" onchange="On_Month()">
</select>
<input type="button" value=" 上月 " onclick="Skip('-')">
<input type="button" value=" 下月 " onclick="Skip('+')">
</td>
</form>
</tr>
</table>
</asp:Content>我直接把HTML复制过来的,估计不对,但是我不知道C#里应该怎么写啊?新手请教一下。莫怪
<table width="170" border="1" cellspacing="0" cellpadding="0">
<form name="when">
<tr>
<td align="center">
<div id="NavBar" style="position: relative; top: -1px;">
<select name="month" onchange="On_Month()">
</select>
</div>
<input type="button" value=" 上月 " onclick="Skip('-')">
<input type="button" value=" 下月 " onclick="Skip('+')">
</td>
</tr>
</form>
</table>
</asp:Content>
<table width="170" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<div id="NavBar" style="position: relative; top: -1px;">
<select name="month" onchange="On_Month()">
</select>
</div>
<input type="button" value=" 上月 " onclick="Skip('-')">
<input type="button" value=" 下月 " onclick="Skip('+')">
</td>
</tr></table>
</form>这样~·
貌似你表单里 就没有year的id或者name
<form name="when">
<table width="170" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<div id="NavBar" style="position: relative; top: -1px;">
<select name="month" onchange="On_Month()">
</select>
<input type="text" name="year" size="4" maxlength="4" onkeypress="returnCheck_Nums()" onkeyup="On_Year()"><br>
<div id="Clock" style="position: relative; top: -2px;">
</div>
</div>
<div id="Calendar" style="position: relative; top: -3px;">
</div>
<input type="button" value=" 上月 " onclick="Skip('-')">
<input type="button" value=" 下月 " onclick="Skip('+')">
</td>
</tr>
</table>
</form>
<script>
if (document.all) {
for (j = 0; j < Month_Label.length; j++) {
document.writeln('<option value=' + j + '>' + Month_Label[j]);
}
}
</script>
</asp:Content>一运行就说month或者year获取不到值,烦死我了!!!!!!!!!!!!
document.writeln('<option value=' + j + '>' + Month_Label[j]);
}直接写这个for循环
var Mid_Screen = Math.round(document.body.clientWidth / 2);
document.when.month.selectedIndex = Current_Month;
document.when.year.value = Current_Year;
Selected_Month = Current_Month;
Selected_Year = Current_Year;
Make_Calendar(Current_Year, Current_Month);
}这个里面的document.when.month.selectedIndex = Current_Month;的时候出错的