function date(day, month, year) {
month += "";
if (month.length <= 1)
month = "0" + month;
document.location.href = "<?php $_SERVER['PHP_SELF'];?>?page=events&day="
+ day + "&month=" + month + "&year=" + year;
}
我借助Youtube视频制作了这个功能,问题是,我不想看到我在网址中选择的日期。任何人都可以帮我这么做吗?
答案 0 :(得分:1)
嗯,你可以这样做:
<form action="<?php echo $_SERVER['PHP_SELF']."?page=events";?>" method="post" id="calender-form">
<input type="hidden" name="day" value="<?php echo $_POST['day'];?>"/>
<input type="hidden" name="month" value="<?php echo $_POST['month'];?>"/>
<input type="hidden" name="year" value="<?php echo $_POST['year'];?>"/>
</form>
在你的函数date()而不是:
document.location.href=......
这样做:
var calenderForm=document.getElementById("calender-form");
calenderForm.day.value=daystring;
calenderForm.month.value=monthstring;
calenderForm.year.value=year;
calenderForm.submit;
}
用$ _POST替换$ _GET。试试这个它应该工作。如果您遇到问题,请在评论中添加。如果它有助于你标记为答案并投票。谢谢!