日期:2014-05-16  浏览次数:20380 次

? - document.onready没起作用
为什么我的document.onready没作用?
想在网页加载完成后, 得到form.

JScript code

<html>

<head>
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Content-Language" content="zh-cn"/>
<meta http-equiv="Content-Type" content="text/html; charset=GBK"/>

<script type="text/javascript">

function detect() {
    
    //fill
    var aForm = document.forms[0];
    alert(aForm);
}

document.onready = detect();

</script>
</head>

<body>

<form action="">
<input type="hidden" name="act" value=""/>
</form>

</body>

</html>



------解决方案--------------------
document.onready = detect;
------解决方案--------------------
探讨

document.onready = detect;

------解决方案--------------------
真奇怪了,为何我不知道document有一个onready事件?!
JScript code

window.onload=detect;

------解决方案--------------------
document.onready 我也没见过
你是想用JQ么 那么你要引入JQ 然后参照API写是吧