I have this script http://pastebin.com/PY922MyL
How can i bind the slideSwitch method to window such that i can call it with window.slideSwitch() ?
| SitePoint Sponsor |


I have this script http://pastebin.com/PY922MyL
How can i bind the slideSwitch method to window such that i can call it with window.slideSwitch() ?




Not sure if I understand, but have you tried:
window.onload = functionname
Chuck Norris is so tough, mosquitos ask for permission before they bite him


i'm not trying to run it onload.
i'm trying to create the method in the window object.
so i should be able to run the method by just typing slideSwitch() in the console.
but i wan it enclosed in the self executing function and only expose the method to the window object at the end.
edit: hmm...i'd found the anwser. http://pastebin.com/3CMsCkSK


Last edited by paul_wilkins; Apr 13, 2012 at 02:08.
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
Bookmarks