Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
211 views
in Technique[技术] by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...