java script Archive

This site I am working is seems to hate me (as the last few posts can contest). We ran into another problem last night when the Publisher tried to create a new Banner on the Rotating Banner. When they entered the title that included an apostrophe none of the text after the apostrophe showed up. Being a sys admin my answer was just don’t use apostrophes, but they are all communications majors so to them there is a big difference between “Childrens” and “Children’s”.
From my understanding it is because the JSON is using the Single Quote for escape characters hence the apostrophe appears to be the end of the text.

The work around for this was to use the ASCII code for apostrophe so publishers have to enter the text with the code instead of an apostrophe. The Client would then convert the code into an ‘.

Be the first to comment

jQuery Rotating Banner Errors – IE vs Chrome

Posted October 18, 2012 By Kevin Bennett

So we created a Rotating Banner that pulls from the Blog Posts in the Sharepoint Blog but were having an issue with it showing in IE and Firefox but not in chrome. The actual solution I will post later but wanted to capture the fix incase it comes up someplace else.

In the jQuery SPServices Operation of GetListItems we needed to change:

jQuery(xData.responseXML).find("z\\:row").each(function(i)
to
jQuery(xData.responseXML).find("z\\:row, row").each(function(i)

I think it actually will do 2 searches of the List Items but since there are so few (max 4 or 5) I don’t think it matters much.

Be the first to comment

Hiding elements on a page

Posted January 15, 2012 By Kevin Bennett

The other day I had a user ask about removing the (More Links) wording from a Link List Web Part. Basically she had but the view into Summary View and with the number of items that appears it also states at the bottom to click to see more links. But all her links were showing up so she just wanted that removed.

Being my normal helpful self I seen no reason to argue that it didn’t matter if it was on the page or not and searched for a quick script to accomplish this.

 

The code is as follows

[code]

<script>

document.getElementById(“onetidMoreAnn”).innerHTML=””

</script>

[/code] 

I then called the code from a Content Editor Webpart and the More Links Disappeared.

I got the onetidMoreAnn by using the Developer Dashboard in IE and finding that links ID in attributes. I imagine you can do this for any element on a page.

Simple and I still look like a hero.

Be the first to comment
%d bloggers like this: