admin管理员组

文章数量:1394172

<select name='cmg_select'  onChange="javascript:window.location.href='index.php?'+this.value">
    <option value='pening'> pening </option>
    <option value='plete'> plete </option>
    <option value='pening'> pening </option>
</select>

The concatenation is not working.

<select name='cmg_select'  onChange="javascript:window.location.href='index.php?'+this.value">
    <option value='pening'> pening </option>
    <option value='plete'> plete </option>
    <option value='pening'> pening </option>
</select>

The concatenation is not working.

Share Improve this question edited Mar 2, 2016 at 5:43 Caleb Eby 3864 silver badges14 bronze badges asked Jul 4, 2010 at 7:02 BharanikumarBharanikumar 25.7k50 gold badges135 silver badges201 bronze badges 2
  • 1 onChange can and should be written onchange . – Pekka Commented Jul 4, 2010 at 7:33
  • And you shouldn't have two items with the same label and value. – Pekka Commented Jul 4, 2010 at 7:33
Add a ment  | 

3 Answers 3

Reset to default 3
  1. Remove the javascript: portion
  2. Remove the href portion

The result :

< select name='cmg_select' onchange="window.location='index.php?'+this.value" >

Try this instead

<select name='cmg_select' onChange="window.location.href='index.php?'+this.options[this.selectedIndex].value">
<option value='pening' > pening </option>
<option value='plete' > plete </option>
<option value='pening' > pening </option>
</select>

Remove the javascript: from the onchange attribute.

本文标签: htmlelement onChange javascript not workingStack Overflow