微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php 脚本中的表单问题和使用 javascript onchange href 事件

如何解决php 脚本中的表单问题和使用 javascript onchange href 事件

我有一个问题 - 我不得不说 - 我多年前编写的非常旧的代码(当时它可以工作) 这是:

<form name="eingabe" method="post" action="index.PHP?aktion=linkliste" enctype="multipart/form-data">
    <table width="80%" align="center" border="1" cellspacing="0" cellpadding="0">
        <tr><td colspan="3" align="center" style="font-size:14pt;font-weight:bold;">Was möchten Sie bearbeiten</td></tr>
        <tr>
            <td colspan="3" align="center">
                <select name="geraetebearb" onChange=location.href("index.PHP?aktion=geraeteverleih&geraetebearb="+this.options[this.selectedindex].value+"")>
                    <option value="0">Bitte auswählen:?</option>
                    <option value="tbl_geruest">Leihgebühren Gerüst</option>
                    <option value="tbl_geraete">Leihgebühren Geräte</option>
                </select>
            </td>
        </tr>
    </table>
</form>

当我更改选择组中的选项时,onchange 方法自动调用新的 url,然后我进入了我想要更改的类别。但是现在 -> 什么也没发生? 有没有人给我提示,我必须改变什么才能让它再次工作? 感谢大家的投入。

雷内

解决方法

所以,我自己找到了答案,如果其他人需要的话:

用 window.location= 替换 location.href((也去掉末尾的“)”....)

<form name="eingabe" method="post" action="index.php?aktion=linkliste" enctype="multipart/form-data">
    <table width="80%" align="center" border="1" cellspacing="0" cellpadding="0">
        <tr><td colspan="3" align="center" style="font-size:14pt;font-weight:bold;">Was möchten Sie bearbeiten</td></tr>
        <tr>
            <td colspan="3" align="center">
                <select name="geraetebearb" onChange=window.location="index.php?aktion=geraeteverleih&geraetebearb="+this.options[this.selectedIndex].value+"">
                    <option value="0">Bitte auswählen:?</option>
                    <option value="tbl_geruest">Leihgebühren Gerüst</option>
                    <option value="tbl_geraete">Leihgebühren Geräte</option>
                </select>
            </td>
        </tr>
    </table>
</form>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。