Only one pages where it's required. Given that any JavaScript usually requires a few lines of code, sticking the extra 5 or 6 in to handle the push isn't a biggy. If I had my way I'd rip every script call out of the master pages. But then SharePoint probably wouldn't do much afterwards. :)
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Monday, 26 October 2009 4:29 PM To: ozMOSS Cc: ozMOSS; [email protected] Subject: RE: Javascript - add onload to _spBodyOnLoadFunctionNames but then you will have to add the web part to every single pages :) Paul Noone <paul.no...@ceosy d.catholic.edu.au To > ozMOSS <[email protected]> Sent by: cc ozmoss-boun...@oz moss.com Subject RE: Javascript - add onload to _spBodyOnLoadFunctionNames 10/26/2009 01:03 PM Please respond to ozMOSS <[email protected] m> I take it all back it works! The problem is that any custom js functions wouldn’t run until the page is checked in! Ahahahaha. God I’m an idiot. :D From: [email protected] [mailto:[email protected]] On Behalf Of Paul Noone Sent: Monday, 26 October 2009 4:02 PM To: ozMOSS Subject: RE: Javascript - add onload to _spBodyOnLoadFunctionNames I haven’t added anything to the master. Is that the part I’m missing?? J I was hoping to do all this on an ad hoc basis using a Content Editor web part. Regards, Paul Online Developer, ICT CEO Sydney From: [email protected] [mailto:[email protected]] On Behalf Of Steven Berry Sent: Monday, 26 October 2009 3:53 PM To: ozMOSS Subject: RE: Javascript - add onload to _spBodyOnLoadFunctionNames Hey Paul, Have you tried lazy loading your javascript function so im assuming the file is up in the masterpage and your just calling from the body? Such as: http://wonko.com/post/painless_javascript_lazy_loading_with_lazyload Which has events fired off the first instance? Else your functions should work: function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } I’ve just tested this and works ok on my WSS, loads 1st function and then runs second ok From: Paul Noone [mailto:[email protected]] Sent: Monday, 26 October 2009 3:44 PM To: ozMOSS Subject: Javascript - add onload to _spBodyOnLoadFunctionNames Hi all, There are two basic methods that I have found to run a js function (inside a Content Editor web part) and neither are working for me. I’ve tried: _spBodyOnLoadFunctionNames.push("myFunction"); function myFunction() { … } AND function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } addLoadEvent(nameOfSomeFunctionToRunOnPageLoad); addLoadEvent(function() { /* more code to run on page load */ } ); Has anyone else successfully done this and can they provide a working example? This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately if you have received this e-mail by mistake and delete this e-mail from your system. No responsibility is assumed by the company or its employee to any other person for any loss or damage (whether caused by negligence or not) arising from the use of the information and advice contained herein. Finally, it is your responsibility to check any attachments for viruses and defects before opening or sending them on. _______________________________________________ ozmoss mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ===================================================================== Disclaimer: This message is intended only for the use of the person to whom it is expressly addressed and may contain information that is confidential and legally privileged. If you are not the intended recipient, you are hereby notified that any use, reliance on, reference to, review, disclosure or copying of the message and the information it contains for any purpose is prohibited. If you have received this message in error, please notify the sender by reply e-mail of the misdelivery and delete all its contents. Opinions, conclusions and other information in this message that do not relate to the official business of the Company shall be understood as neither given nor endorsed by it. _______________________________________________ ozmoss mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss _______________________________________________ ozmoss mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
