开发者

element onChange javascript not working

开发者 https://www.devze.com 2023-01-05 11:28 出处:网络
<select name=\'cmg_select\'onChange=\"javascript:window.location.href=\'index.php?\'+this.value\">
<select name='cmg_select'  onChange="javascript:window.location.href='index.php?'+this.value">
    <option value='pening'> pening </option>
    <option value='complete'> complete </option>
    <option value='pening'> pening </option>开发者_高级运维
</select>

The concatenation is not working.


  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='complete' > complete </option>
<option value='pening' > pening </option>
</select>


Remove the javascript: from the onchange attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消