이벤트를 사용할 때마다 onload 이벤트가 포함 된 줄을 가리키는 "Object expected"라는 자바 스크립트 오류가 발생합니다. 다음은 내 웹 페이지의 간단한 표현입니다.onload 이벤트가 'object expected'오류를 throw합니다.
<html>
<head>
<script type='text/javascript' src='myScript.js'>
//script containing doSomething()
</script>
</head>
<body onload = "doSomething('stringArg', 0);"> //<--does not execute, throws error, EDITED for proper quotation
//body of site
<script type='text/javascript'>
//test call
doSomething('stringArg', 0); //<--executes just fine, no errors
</script>
</body>
</html>
죄송합니다. 사실 내 코드는 정확한 인용문을 가지고 있습니다. 글을 올리면 글을 쓸 때가 막혔습니다. 나는 이것을 반영하기 위해 위의 글을 편집했다. – Paul