Cannot set property of null (error only in Google Chrome)
I am using a script called ajax_load.js that defines a function, ajaxpage(), that allows a person to load the contents of an external page into a div item. I have it setup so I may use ajaxpage() to load pages with other div items in it. The problem is that I cannot reference the div items loaded by ajaxpage(). I have provided an example below to illustrate this. It was working fine in the prior version of Google Chrome and is still working fine in IE 8, IE 7, and Firefox. The version of Chrome I am currently using is 184.108.40.206
Here is the example; All the files used in this example are listed below:
The breakdown of what is happening:
ajaxtest.html is the primary file here. It loads ajax_load.js into it, which defines the ajaxpage() function.
ajaxpage() works like this .. ajaxpage('external_page_name.file_ending', 'target_div_element');
ajaxtest.html contains a div item with the id "sample_target". ajaxpage() is used to load the contents of ajaxtest_external.html into it, which is another div item with the id "sample_target_external".
The function used to try and change the innerHTML value of "sample_target_external" is, load_text(), which is defined in ajaxtest.html
If you want to see it all in action, load up the following url:
This code was working just fine in the prior stable version of chrome, and still works properly in IE 8, IE 7, and Firefox without any errors (The version of chrome giving me problems is 220.127.116.11). Does anyone know how to go about fixing this? Is this something wrong with the latest version of chrome, or is this on my end? ANY help would be greatly appreciated. The site I am currently working on relies heavily on this working, and having to change things means altering several thousand lines of code.
A quick test shows that Chrome throws this error if the element does not exist.
I suspect, as you are using the image onload, that Chrome loads images before rendering the html.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)