Executing custom JavaScript in SharePoint page

scientist_430-copy.gif 

Probably once in a while you will have someone asking you to create that little functionality – mostly visual that is not available in sharepoint – like recently I was asked to create a little header on a home page of collaboration portal performing some basic DATETIME manipulation and displaying it to the user. Or you might be asked to incorporate some CURRENT WEATHER or other type of functionality that will be provided by a 3rd party using a JavaScript.

So, I dont know if you knew it – but you could use ContentEditorWebPart (from sharepoint) to insert scripts and other raw HTML.

Upon adding ContentEditorWebpart to any of your pages go to webpart properties and Click “Edit Source” .. this will bring up source editor where you can type your JavaScript and HTML stuff and when one just save it and reload the page.

It’s quite powerfull since not only you can add new features to sharepoint page but also edit existing behavior of sharepoint by overwriting CSS classes or JS methods .. so be careful :)

Important to know that those changes you make will not replicate accross many pages just the one that you placed a webpart on to!

Cheers!

This entry was posted in MOSS, sharepoint and tagged , , . Bookmark the permalink.

Comments are closed.