功能比较简单:Select 分别选择 年和月,然后将获得的当月天数放到Hidden隐藏空间中,然后跳转到ajax目标页面处理。但现在的问题是,根本无法跳转到目标页面,请大家帮忙看下问题应如何解决?谢谢!主要代码如下:生成天数的函数
var getDaysInMonth = function(year,month){
month = parseInt(month,10);
var temp = new Date(year,month,0);
alert(year); alert(month);
return temp.getDate();
}表单
<form id="frm1" name="frm1" method="post" action="ftt_cltmain_viewOK.asp">
<select id="slt_year" name="slt_year">
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select>
当前月份
<select id="slt_month" name="slt_month" onChange="getDaysInMonth(document.getElementById('slt_year').value,this.value)">
<% for i = 1 to 12 %>
<option value="<%=i%>"><%=i%></option>
<% next %>
</select>
<input type="hidden" name="hdn_day" id="hdn_day" value="getDaysInMonth(document.getElementById('slt_year').value,this.value)">
</form>jquery触发
<script>
$(document).ready(function(){
$('#slt_month').change(function(){
$.ajax({
url: "ftt_cltmain_viewOK.asp",
type: "POST",
data: $(form).serialize(),
success: function(response) { },
error: function(request,error){
}
});
})
})</script>
var getDaysInMonth = function(year,month){
month = parseInt(month,10);
var temp = new Date(year,month,0);
alert(year); alert(month);
return temp.getDate();
}表单
<form id="frm1" name="frm1" method="post" action="ftt_cltmain_viewOK.asp">
<select id="slt_year" name="slt_year">
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select>
当前月份
<select id="slt_month" name="slt_month" onChange="getDaysInMonth(document.getElementById('slt_year').value,this.value)">
<% for i = 1 to 12 %>
<option value="<%=i%>"><%=i%></option>
<% next %>
</select>
<input type="hidden" name="hdn_day" id="hdn_day" value="getDaysInMonth(document.getElementById('slt_year').value,this.value)">
</form>jquery触发
<script>
$(document).ready(function(){
$('#slt_month').change(function(){
$.ajax({
url: "ftt_cltmain_viewOK.asp",
type: "POST",
data: $(form).serialize(),
success: function(response) { },
error: function(request,error){
}
});
})
})</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货