How to place and run javascipt in Sharepoint aspx files?
Write this (or append to an existing the "PlaceHolderAdditionalPageHead" section) the followings (in the aspx):
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<script language="JavaScript">
<!-- Begin
function HelloWorld()
{
alert("Hello World!");
}
// End -->
</script>
</asp:Content>
... and supplement the "PlaceHolderBodyAreaClass" section (or create new one if it does't exist) as follows:
<asp:Content ContentPlaceHolderId="PlaceHolderBodyAreaClass" runat="server">
<script LANGUAGE="JavaScript">
window.attachEvent('onload', HelloWorld);
</script>
</asp:Content>
... and voila! :)