将HTML jumpmenu更改为PHP

时间:2011-05-20 13:20:49

标签: php html drop-down-menu

以下是我在HTML中的代码:

<FORM NAME="jumpform">
<SELECT NAME="pages" onChange = "window.status = this.options[this.selectedIndex].text">
<OPTION SELECTED VALUE="tutorial_part1.html">1 of 7
<OPTION VALUE="tutorial_part2.html">2 of 7
<OPTION VALUE="tutorial_part3.html">3 of 7
<OPTION VALUE="tutorial_part7_frames.html">4 of 7
<OPTION VALUE="tutorial_part8.html">5 of 7
<OPTION VALUE="tutorial_part9.html">6 of 7
<OPTION VALUE="tutorial_part10_frames.html">7 of 7
</SELECT>
<INPUT VALUE="Go" TYPE=BUTTON onClick = "jump (document.jumpform.pages.options[pages.selectedIndex].value)">
</FORM>

当我使用PHP向页面添加页眉和页脚时,跳转菜单不起作用。选择它们时选项会发生变化,但单击“开始”时没有任何反应。我怎样才能重写这个,以便当我将php代码添加到页面时,当我将文件扩展名更改为.php时,跳转形式仍然有效?

感谢。

1 个答案:

答案 0 :(得分:0)

在表单之前关闭php标签,然后在表单之后关闭

<?php //php code
?>
<FORM NAME="jumpform">
<SELECT NAME="pages" onChange = "window.status = this.options[this.selectedIndex].text">
<OPTION SELECTED VALUE="tutorial_part1.html">1 of 7
<OPTION VALUE="tutorial_part2.html">2 of 7
<OPTION VALUE="tutorial_part3.html">3 of 7
<OPTION VALUE="tutorial_part7_frames.html">4 of 7
<OPTION VALUE="tutorial_part8.html">5 of 7
<OPTION VALUE="tutorial_part9.html">6 of 7
<OPTION VALUE="tutorial_part10_frames.html">7 of 7
</SELECT>
<INPUT VALUE="Go" TYPE=BUTTON onClick = "jump (document.jumpform.pages.options[pages.selectedIndex].value)">
</FORM>
<?php //other php code 
?>

应该是它。