Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting this Javascript runtime error?

I've got the following JavaScript on my web page...

64    var description = new Array();
65    description[0] = "..."
66    description[1] = "..."
...
78    function init() {
79        document.getElementById('somedivid').innerHTML = description[0];
80    }
81
82    window.onload = init();

In Microsoft Internet Explorer it causes the following error...

A Runtime Error has occurred.
Do you wish to debug?

Line: 81
Error: Not implemented

javascript runtime error

Line 79 executes as expected.

If line 79 is commented out, it still throws the error.

If I comment out line 82, then the function does not execute and there is no error.

like image 579
Zack Peterson Avatar asked Dec 06 '22 07:12

Zack Peterson


1 Answers

Shouldn't line 82 read:

window.onload = init;

When you do "init()" it's a call to a function that returns void. You end up calling that function before the page loads.

like image 94
Ates Goral Avatar answered Dec 24 '22 13:12

Ates Goral