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>