You could also try this approach without using a framework.
You could also try this approach without using a framework: window. Onload = (function(){ return function(){ var aarr = ; for (var z=1; zGetElementById("a"+z)); alert(aarrz-1. Id); } }; })(); JSFiddle.
Thanks Richard, unfortunately it did not work. – Jamex Sep 7 at 0:10 I made some changes to your loop and it works fine for me..see the fiddle added :) – Richard Aikoroje Sep 7 at 15:13 Thanks Richard, I will give it a try. – Jamex Sep 7 at 18:24 @Richard Aikoroje: Next time fork the fiddle.In addition: (function(){})(); is useless.
The only thing you achieve is that you expand the scope. – Saxoier Sep 8 at 1:02 @Saxoier : You're right. I added the parenthesis around the function to make it easier to see whats happening there.. its not required:).
– Richard Aikoroje Sep 8 at 15:32.
If you can use jquery, then you can use the document ready listener: $(document). Ready(function() { var aarr = ; for (var z=1; zReadyState === "complete") { init(); } // call whatever function you want.
Thanks Rick, I am not using jquery, so this won't work for me. – Jamex Sep 7 at 0:11 see edit from above – SublymeRick Sep 7 at 0:48 Thanks, I read that post before and I actually am getting this to work for firefox with that code, unfortunately, IE versions are all giving me errors. I am walking through the script line by line.
– Jamex Sep 7 at 4:40.
The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images and sub-frames have finished loading. MDN - window.
Onload I guess you try calling code outside of onload. See this fiddle.
Better to use a function without pre-scanning the dom to create a cache, Pre-scanning is not needed when you use a simple function with a cache construction. With jQuery you can can create a function like this (native javascript method below this): window. __jcache = {}; window.
$jc = function(u) // jQuery cache { if( you == undefined ) { return window. JQuery; } if( typeof you == 'object' || typeof you == 'function' ) { return window. JQuery(u); } if( window.
__jcacheu == undefined ) { window. __jcacheu = window. JQuery(u); } return window.
__jcacheu; }; Or without a framework (native javascript): window. __domcache = {}; window. GetObj = function(u) // jQuery cache { if( you == undefined ) { return null; } if( typeof you == 'object' || typeof you == 'function' ) { return u; } if( window.
__domcacheu == undefined ) { window. __domcacheu = document. GetElementById(u); } return window.
__domcacheu; }; So you can do: var o = $jc('a1'); // for jquery version var o = getObj('a1'); // The native javascript method (jamex) That does the trick. Greetz, Erwin Haantjes.
I don't know/have jquery. – Jamex Sep 7 at 4:42 The second code is the non-jQuery version, the getObj function – Erwinus Sep 7 at 20:54 below the line "Or without a framework (native javascript):" is yours – Erwinus Sep 7 at 21:04.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.