将 HTML 跳转菜单更改为 PHP

发布于 2024-11-08 12:18:22 字数 830 浏览 0 评论 0原文

这是我的 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 时,跳转表单仍然有效?

谢谢。

Here is the code I have in 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>

When I use PHP to add a header and a footer to the page, the jump menu doesn't work. the options change when you select them, but nothing happens when you click "Go". How can I rewrite this so that when I add php code to the page, and when I change the file extensions to .php, the jumpform still works?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清眉祭 2024-11-15 12:18:22

例如,在表单之前和表单之后关闭 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 
?>

就应该是这样。

close php tags before form, and after the form for example

<?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 
?>

that should be it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文