javascript - addEventListener load on ajax load WITHOUT jquery -


i have 4 html files , 4 javascript files. each javascript file loaded externally each html file

index.html loads javascript.js 1.html loads javascript1.js 2.html loads javascript2.js 3.html loads javascript3.js

the issue i'm having index.html uses ajax load 1 of 3 other pages when specific button pressed. supposed happen particular page load own corresponding javascript program @ end of program contains window.addeventlistener should run on "load" , run function "registerlisteners". registerlisteners registers event listener on button on page currentyl displays alert testing.

what have figured out parameter "load" window.addeventlisener doesnt seem valid when page loaded dynamically ajax.

i cant put of code in main javascript because contains getelementbyid calls call elements 1 of numbered pages that, if executed on main page load generate errors because specific id's dont exist yet.

this homework , need pointed in right direction doing html5 , javascript without jquery. understand might easier jquery, need figure out how without time being.

would there such thing window.addeventlistener("ajaxload", somefunction(), false) ???

instead of adding event listener programatically, possibly insert bare javascript function @ end of ajax'ed content. run when content loaded, calling in parent window.

ajax blah blah blah <script type="text/javascript">   childcontentloaded();  //or whatever need  </script> 

you may need add "parent".functionname()


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -