I have 4 html files and 4 javascript files. Each javascript file is loaded externally from 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 that I'm having is that index.html uses AJAX to load one of the 3 other pages when a specific button is pressed. Then what is supposed to happen is that particular page would load its own corresponding javascript program which at the end of that program contains a window.addEventListener that should run on "load" and run the function "registerListeners". RegisterListeners then registers an event listener on a button on that page which currentyl just displays an alert for testing.
What I have figured out is that the parameter "load" for window.addEventLisener doesnt seem to be valid when the page is loaded dynamically with ajax.
I cant put all of the code in the main javascript because it contains some getElementById calls that call elements from one of the numbered pages that, if executed on main page load will generate errors because those specific ID's dont exist yet.
This is homework and so I need to get pointed in the right direction to doing this with html5 and javascript WITHOUT jquery. I understand that it might be easier with jquery, but I need to figure out how to do it without for the time being.
Would there be such a thing as window.addEventListener("AJAXload", someFunction(), false) ???