php模板中的select控件的onchang事件代码不起作用
php模板中的select控件的onchang事件代码不起作用,如下:<script language="JavaScript">
function s_changed() //cjq add
{
alert("s_changed");
var index=document.forms['theForm'].s[].selectedIndex;
if ((document.forms['theForm'].s[].options[index].value=='2')
{
alert("ok");
...
}
}
</script>
<form name="theForm" action="o.php?act=s" method="post">
<table>
<tr>
<td scope="col">1</td>
<td scope="col">2</td>
</tr>
{foreach from=$g1 item=g name="g"}
<tr>
<td>1</td>
<td><select name="s[]" onchange="JavaScript:s_changed()">
<option value=" ">请选择</option>
{foreach from=$s1_list item=s}
<option value="{$s.name}" {if $s.name eq $s1}selected{/if}>{$s.name}</option>
{/foreach}
{/if}
</select>
</td>
</tr>
{/foreach}
</table>
</form>
请问这是为什么?