2010-07-04 108 views
1
<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> 

串联不起作用。元素onChange javascript不起作用

+1

'onChange'可以而且应该写成'onchange'。 – 2010-07-04 07:33:10

+0

你不应该有两个具有相同标签和值的项目。 – 2010-07-04 07:33:40

回答

3
  1. 卸下javascript:
  2. 卸下href

其结果是:

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

1

onchange属性中删除javascript:

2

尝试此代替

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

这应该是正确的答案。 – PKHunter 2015-08-29 07:46:57