注意:这个需要在提示页面中加载,从而传到页面;
<span id ="y" >
。。。。
这儿是你的年和月的值提示
。。。。
</span>
<script>
function init(){
var theA = document.getElementById ("y");
var theB = theA.getElementsByTagName("select");
theB[0].remove(0);
theB[0].remove(0);
theB[1].remove(0);
theB[1].remove(0);
var cur_date = new Date();
var cur_year = cur_date.getFullYear();
var cur_month = cur_date.getMonth()+1;
for (var i = 0; i <theB[0].length; i++) { //循环搜索下拉列表中和当前年份caption相等的值
var temp = theB[0].options[i].text;
//alert(temp);
if (temp == cur_year) {
//alert('Find!!! ' + temp + ' ' + i);
theB[0].options[i].selected = true;
break;
}
}
for (var i = 0; i <theB[1].length; i++) { //循环搜索下拉列表中和当前年份caption相等的值
var temp = theB[1].options[i].text;
//alert(temp);
if (temp == cur_month) {
//alert('Find!!! ' + temp + ' ' + i);
theB[1].options[i].selected = true;
break;
}
}
promptButtonFinish();
}
</script>
<body onload=init()>
这样就自动提交了,参数从提示页面传到页面。
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞2
添加新评论1 条评论
2017-09-07 11:28