Solved

SharePoint custom page

Posted on 2013-01-22
2
304 Views
Last Modified: 2013-03-06
Hello,

I have couple lines of Javascript which when put in a simple HTML page loads a small div.

How can I put this on a SharePoint page and load it the same way.

This script is like using jQuery JS file and loads a div using a function...

I have also put this on the SharePoint page using the designer, but nothing loads...

Thanks
0
Comment
Question by:masdf123
2 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 250 total points
ID: 38808633
Hi,

that depends. You can either use SharePoint designer or add a CEWP (Content Editor Web Part).
Which SharePoint version do you use?
Can you ensure that jQuery is loaded?
Can you ensure that the jQuery selector finds the div?

Perhaps you can attach your script, some part of the page html code (the generated one, not the ASPX markup) and/or a screenshot (what should go where).

HTH
Rainer
0
 
LVL 15

Assisted Solution

by:colly92002
colly92002 earned 250 total points
ID: 38809465
In SP 2010, I create a custom masterpage (by copying het default master page and editing it, then making this new version the default on any pages that need it using Sharepoint designer) and add something like this to it:

<body scroll="no" onload="if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();" class="v4master">
  <form runat="server" onsubmit="if (typeof(_spFormOnSubmitWrapper) != 'undefined') {return _spFormOnSubmitWrapper();} else {return true;}">
  <asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" >
  <Scripts>
	<asp:ScriptReference Path="<% $SPUrl:~sitecollection/Style%20Library/js/jquery-1.7.1.min.js%>"  runat="server"></asp:ScriptReference> 
        <asp:ScriptReference Path="<% $SPUrl:~sitecollection/Style%20Library/js/RenameILikeIt.js%>" runat="server"></asp:ScriptReference> 
        <asp:ScriptReference Path="<% $SPUrl:~sitecollection/Style%20Library/js/CESASecurity.js%>" runat="server"></asp:ScriptReference> 
	</Scripts> 
  </asp:ScriptManager>

Open in new window


I'm using a ScriptManager object at the top of the <body> tag after the <form> tag , and I include my jQuery files there.  I have hosted my jQuery files in the "Style Library" which is a standard library available in teh Sharepoint site collection.

Once this is working, I wrap this all up into a Visual Studio solution package for deployment, but that stage is only neccessary if you want to be able to build solutions.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question