Solved

SharePoint custom page

Posted on 2013-01-22
2
320 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Setting up a Windows Server 2008 R2 to allow file sharing to a MAC (Apple) 4 48
Json and ajax 1 18
Aspx calendar pop up control 3 25
REST call Failing 1 7
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
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 the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

713 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