Re: [問題] Firefox3按下Submit後不會跳頁的問題
已經有改過了一些,但還是有問題
所以又上來請教了 = ="
目前的情況是我把原先的document.all改成了document.getElementByTagName('XXX')
另外加了<form></form>
執行的結果是在網址列會顯示「abc.php?year_sel=2008&month_sel=5&submit=」
預設接在abc.php?後面的變數變成了year_sel及month_sel了??
後面多了一個【&submit=】
但還是不會跳頁就是了
且firebug有出現sely is undefined的訊息
>"<
還請高手指教一下
(小弟是JS的新手)
下面是改了一點的程式碼...
※ 引述《whk ()》之銘言:
: ==========================我是第一段程式===修改了一點=================
: //取得所選取的年及月份的JS,及按下submit時接在abc.php後的網址(就是年+月)
: <script type="text/javascript">
: function change_month()
: {
var sely=document.getElementsByTagName('year_sel');
var sely=document.getElementsByTagName('month_sel');
: var year=sely.options[sely.selectedIndex].value;
: var month=selm.options[selm.selectedIndex].value;
: windows.location.href="abc.php?presel_year="+year+"&presel_month="+month;
: }
: </script>
: ==========================我是第二段程式===沒改==============
: //取得所選取的年月,及預設的年月欄位值
: <?
: $today=getdate();
: $this_month=$today['mon'];
: $this_year=$today['year'];
: //取得所選的年份資料
: if(isset($presel_year) && $presel_year!="") {
: $now_year=$presel_year;
: } else {
: $now_year = $this_year;
: }
: ?>
: <select name="year_sel">
: <?
: //預設顯示"年份"的欄位值
: for($j=2007;$j<=$this_year;++$j) {
: $default_year_string=$j==$now_year?"selected=\"selected\"":"";
: echo "<option value=\"$j\" $default_year_string>$j 年</option>\n";
: }
: ?>
: </select>
: <select name="month_sel">
: <?
: //取得所選的月份資料
: if(isset($presel_month) && $presel_month!="") {
: $now_month = $presel_month;
: } else {
: $now_month = $this_month;
: }
: //預設顯示月份的欄位值
: for($i=1; $i<=12; ++$i) {
: $default_month_string=$i==$now_month?"selected=\"selected\"":"";
: echo "<option value=\"$i\" $default_month_string>$i 月</option>\n";
: }
: ?>
: </select>
: ==============================我是第三段程式=====================
: <button name="submit" onClick="javascript:change_month()">確定</button>
: 先謝謝回覆的版友!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.133.108.182
※ 編輯: whk 來自: 220.133.108.182 (07/16 18:41)
→
07/16 19:16, , 1F
07/16 19:16, 1F
推
07/16 19:16, , 2F
07/16 19:16, 2F
→
07/16 19:17, , 3F
07/16 19:17, 3F
推
07/16 19:19, , 4F
07/16 19:19, 4F
→
07/16 20:05, , 5F
07/16 20:05, 5F
→
07/16 20:16, , 6F
07/16 20:16, 6F
→
07/16 20:22, , 7F
07/16 20:22, 7F
→
07/16 20:23, , 8F
07/16 20:23, 8F
→
07/17 00:23, , 9F
07/17 00:23, 9F
→
07/17 00:23, , 10F
07/17 00:23, 10F
→
07/17 00:25, , 11F
07/17 00:25, 11F
推
07/17 13:36, , 12F
07/17 13:36, 12F
→
07/17 13:36, , 13F
07/17 13:36, 13F
→
07/19 02:03, , 14F
07/19 02:03, 14F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章
41
173