我想在文档的ready()
上执行onchange事件。jQuery在加载HTML文档后自动执行事件;
原始功能是onchange=“fucntionname(parms)”
;
<select name="country" id="selCountries" onchange="region.changed(this, 1, 'selProvinces')">
<option value="0">{$lang.please_select}{$name_of_region[0]}</option>
<!-- {foreach from=$country_list item=country} -->
<option value="{$country.region_id}" {if $consignee.country eq $country.region_id}selected{/if}>{$country.region_name}</option>
<!-- {/foreach} -->
</select>
的Javascript
<script type="text/javascript">
$(document).ready(function(){
var onll=document.getElementsById('selProvinces');
region.changed(onll, 1, 'selProvinces');
})
</script>
错误我得到
document.getElementsById不是在HTMLDocument的一个功能 。
'ElementById'不'ElementsById'你在需要 – user3154108
singurlar它'Element'不是'Elements'.So改变这样使用多种: - '的document.getElementById('selProvinces “);' –