我有一段JavaScript代碼,可以確保在加載頁面時選中了一個文本框。我已經包括我的代碼如下:使用JavaScript選中的文本框
<!doctype html>
<html>
<head>
<script type="text/javascript">
function box(query){
document.getElementById('query').focus();
}
</script>
</head>
<body onload="box('query');">
<input id="query">
</body>
</html>
我的問題是;我怎樣才能使這個腳本沒有在我的身體標籤onload?
我希望你能理解我想要描述的東西。
由於提前,卡勒姆