Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

SharePoint custom page

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
masdf123
Asked:
masdf123
2 Solutions
 
Rainer JeschorCommented:
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
 
colly92002Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now