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 writtenonchange
. – 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
3 Answers
Reset to default 3- Remove the
javascript:
portion - 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
版权声明:本文标题:html - element onChange javascript not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744591665a2614528.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论