简体   繁体   English

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

[英]Problems with form in php script and using a javascript onchange href event

I have problems with an - I have to say - really old code I programmed many years ago (it worked back then) Here it is:我有一个问题 - 我不得不说 - 我多年前编写的非常旧的代码(它当时有效)这里是:

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

When I changed the option in the selection group the onchange method automatically called the new url and I got to the category I wanted to change.当我更改选择组中的选项时,onchange 方法会自动调用新的 url 并进入我想要更改的类别。 But now -> nothing happens?但是现在->什么都没有发生? Has anybody a tip for me, what I have to change to get it working again?有没有人给我小费,我必须改变什么才能让它再次工作? Thank you all for your input.谢谢大家的意见。

René勒内

So, I found the answer by myself, if someone else needs it:所以,我自己找到了答案,如果其他人需要它:

replace the location.href( with window.location= (also remove the ")" at the end....)将 location.href( 替换为 window.location= (同时删除末尾的“)”....)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM