tag:blogger.com,1999:blog-7192910.post1082027191934439559..comments2024-03-01T08:27:06.252-06:00Comments on PremierPoint Solutions Team Blog: Adding JavaScript to a Content Editor Web Part to Run onLoadPremierPoint Solutionshttp://www.blogger.com/profile/03668782854153322571noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-7192910.post-54760908751464141802011-12-28T12:01:14.668-06:002011-12-28T12:01:14.668-06:00Unfortunately this does not work in SharePoint 201...Unfortunately this does not work in SharePoint 2010.Clemhttps://www.blogger.com/profile/12681428291311150487noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-48971014802955716002011-07-08T10:54:30.964-05:002011-07-08T10:54:30.964-05:00I have a requirement to add a World Clock at the t...I have a requirement to add a World Clock at the top of the left zone on a Team Site. Somehow the code was preventing the drop-down nature of the top navigation bar. The _spBodyOnLoadFunctionNames.push(); function totally solved all my problems. Thanks a million.Henry McClainhttps://www.blogger.com/profile/12076563553100493052noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-89456396082333840392011-05-06T00:51:03.585-05:002011-05-06T00:51:03.585-05:00Hi
Thank you very much for this, works like a cha...Hi<br /><br />Thank you very much for this, works like a charm. Going to insert a Google map at www.uj.ac.za/contactuj. So watch the space!<br /><br />Regards,<br />WernerRW NightBlindhttps://www.blogger.com/profile/16291926677796858767noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-31343550307696406362011-02-02T12:39:56.117-06:002011-02-02T12:39:56.117-06:00I'm having trouble getting the Delicious bookm...I'm having trouble getting the Delicious bookmark linkrolls to always appear in a Content Editor Web part (sometimes they do not load, sometimes they do). Can I use this technique with the linkroll javascript? How? I'm at the "cut & paste" level and don't know javascript very well. :-)louisanravihttps://www.blogger.com/profile/06084131553270961548noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-25375623230238783022010-11-09T07:20:16.841-06:002010-11-09T07:20:16.841-06:00How to change Dynamically SPSite Template Default ...How to change Dynamically SPSite Template Default selection<br /><br />Please Replay anybody for my issue still am not able to resolve this issue.<br /><br />below code is working when i enable the alert statement(i.e if i remove alert stmt it showing default site template under that tab.<br /><br />function setCustom()<br />{ <br /><br /> var element = document.getElementById("ctl00_PlaceHolderMain_InputFormTemplatePickerControl_ctl00_ctl00_LbWebTemplate"); <br /> var tempname= document.getElementById("ctl00_PlaceHolderMain_TemplateName").value; <br /> var tabs=tempname.split(';')<br /> var tabslcid="1033&";<br /> var getTemplates=tabslcid.concat(tabs[1]); <br /> GetWebTemplates(getTemplates,tabs[0]);<br /> var options = element.options; <br /> var test = "false";<br /> var count=0;<br /> //alert(tabs[0]); <br /> for (var i = 0; i < options.length; i++)<br /> { <br /> if (options[i].value == tabs[0])<br /> { <br /> options[i].selected = true; <br /> return;<br /> }<br /> <br /> }<br /> } <br />setTimeout("setCustom();", 200);<br /><br />above code is working when i enable the alert statement(i.e if i remove alert stmt it showing default site template under that tab.<br /><br />so how to do that. if you have any solution send me.<br /><br />Thanks in Advacedmuralihttps://www.blogger.com/profile/08114712876641124322noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-9382192621188323462010-02-22T10:46:12.414-06:002010-02-22T10:46:12.414-06:00This is a great article. Someone mentioned above t...This is a great article. Someone mentioned above that the page loads, and then it takes a second or two, then reloads again. Is there a way to eliminate the delay? I am updating an iframe and the original iframe src is loaded, blinks for a second, and then loads the newly updated src property that I specifiy in my javascript.Unknownhttps://www.blogger.com/profile/14713586882850622914noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-39410869484215171122009-08-20T14:30:28.475-05:002009-08-20T14:30:28.475-05:00I have used the _spBodyOnLoadFunctionNames.push to...I have used the _spBodyOnLoadFunctionNames.push to open a window on a mouseover event with success. However, I must be missing something as I am trying to control "style.display" for a couple of div elements on a page and cannot get it to work. Here is my code:<br /><br />[script type="text/javascript" language="javascript"]<br />_spBodyOnLoadFunctionNames.push(“change_display1”);<br />_spBodyOnLoadFunctionNames.push(“change_display2”);<br /><br />function change_display1() {<br />if (MyDiv1.style.display == ""){<br /> MyDiv1.style.display = "none";}<br />else {<br /> MyDiv2.style.display = "none";<br /> MyDiv1.style.display = ""; }<br />}<br /> <br />function change_display2() {<br />if (MyDiv2.style.display == ""){<br /> MyDiv2.style.display = "none";}<br />else { <br /> MyDiv1.style.display = "none"; <br /> MyDiv2.style.display = ""; }<br />}<br /><br />[/script]<br /><br /><br />[input type="button" value="Div 1" onClick="change_display1()"]<br /><br /> <br />[input type="button" value="Div 2" onClick="change_display2()"]<br /><br />[div id="MyDiv1" style="position:relative; display:none;"]<br /> div info here<br />[/div]<br /><br />[div id="MyDiv2" style="position:relative; display:none;"]<br /> div 2 info here<br />[/div]<br /><br />I get an 'Object expected' error when I click either of the buttons. If anyone can comment with a suggestion on what I am missing it would be greatly appreciated. <br />Regards,<br />DCAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-19057404214111070482009-07-01T03:31:20.461-05:002009-07-01T03:31:20.461-05:00YOU R A LIFE SAVER.
Cant appreciate your tip more...YOU R A LIFE SAVER.<br /><br />Cant appreciate your tip more!<br /><br />Thanks a lot....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-59529553925583532922008-12-18T11:40:00.000-06:002008-12-18T11:40:00.000-06:00Great article. I'm using it to do a global replac...Great article. I'm using it to do a global replace on some text that I don't want to show up on the page (specifically, in a list that is grouped by a category, I don't want to see the category name). It works perfect...except that it takes a second or two to apply, so the user sees the text for a second, then it goes away. Any way that you know of to fire this off before the page is painted? Thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-87888734280909085192008-12-12T08:39:00.000-06:002008-12-12T08:39:00.000-06:00Thanks a million!I was having trouble with my Web ...Thanks a million!<BR/><BR/>I was having trouble with my Web Part for hours. I used your trick and it worked :)Polgarahttps://www.blogger.com/profile/01337573421870402432noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-79013430003460476872008-11-18T14:21:00.000-06:002008-11-18T14:21:00.000-06:00Eli - I think you have some problems in your JavaS...Eli - I think you have some problems in your JavaScript--you'll need to fix that on your own. I can help you with getting it to run when it's supposed to though.<BR/><BR/>You don't need to add the onload piece at all. It's displaying the code in the web part because it's outside the SCRIPT tags. To call the function twice and pass the two keys as you have indicated, just change the line that pushes it onto the _spBodyOnLoadFuncitonNames() Array to reflect that, like so:<BR/><BR/>_spBodyOnLoadFunctionNames.push("displayItem('RootFolder')");<BR/>_spBodyOnLoadFunctionNames.push("displayItem('Folder')");<BR/><BR/>Good luck!Ricky Spearshttps://www.blogger.com/profile/18114053887886617287noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-13376339005546284062008-11-17T13:31:00.000-06:002008-11-17T13:31:00.000-06:00Hi Ricky Im hoping you still might be checking thi...Hi Ricky Im hoping you still might be checking this post. i am not sure what i am doing wrong and hope you can help. I am trying to show the value of a query string on the page (not a pop ) but im not sure what im missing. It seems to just not work in SPS/Wss. it just displays the onload code in the web part. this is the code i put into the content editor<BR/><BR/>[script language="JavaScript"]<BR/>_spBodyOnLoadFunctionNames.push("displayItem");<BR/>function displayItem(key){<BR/>if(queryString(key)=='false') <BR/>{<BR/>result.innerHTML="you didn't enter a ?name=value querystring item.";<BR/>}else{<BR/>result.innerHTML+=queryString(key)+"<BR>";<BR/>}<BR/>}<BR/>[/script]<BR/>onload="displayItem('RootFolder'); displayItem('Folder');"Unknownhttps://www.blogger.com/profile/12048751290016895478noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-65005988287593364892008-07-22T08:18:00.000-05:002008-07-22T08:18:00.000-05:00Ricky--this worked like a charm. Thanks a million!...Ricky--this worked like a charm. Thanks a million!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-30371130745712439892008-06-27T10:13:00.000-05:002008-06-27T10:13:00.000-05:00Hi Ricky, I am having problems trying to add MIT's...Hi Ricky, I am having problems trying to add MIT's Simile Timeline widget(http://simile.mit.edu/timeline/) to my sharepoint site v3. Any suggestions?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-59933389622872678742008-06-18T12:48:00.000-05:002008-06-18T12:48:00.000-05:00Anonymous - It sounds like you are putting some cu...Anonymous - It sounds like you are putting some custom code in your function that SharePoint doesn't like. Try using this method with a simpole function that just contains something simple, such as an ALERT. You'll see it does work. If SharePoint is removing your code, you'll just need to take our bits and pieces and work my trial and error to see what is causing the problems. Good luck!Ricky Spearshttps://www.blogger.com/profile/18114053887886617287noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-40083002259138465722008-05-30T15:43:00.000-05:002008-05-30T15:43:00.000-05:00Hey I tried using the _spBodyOnLoadFunctionNames.p...Hey I tried using the _spBodyOnLoadFunctionNames.push("function");<BR/>command - but moss 2007 still seems to remove the code.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-22372676244801550892008-01-22T10:28:00.000-06:002008-01-22T10:28:00.000-06:00Sally - My first guess is that your JavaScript use...Sally - My first guess is that your JavaScript uses a FORM. SharePoint will remove it if it does.Ricky Spearshttps://www.blogger.com/profile/18114053887886617287noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-16187850206126043172008-01-22T01:17:00.001-06:002008-01-22T01:17:00.001-06:00Hey Ricky, I'm having problems keeping the JS in p...Hey Ricky, I'm having problems keeping the JS in pages in SharePoint. For some reason SharePoint keeps removing the JS. Any idea how to go around that?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-62282515186754292602007-10-17T17:15:00.000-05:002007-10-17T17:15:00.000-05:00I've been trying to get code to execute by using ...I've been trying to get code to execute by using _spBodyOnLoadFunctionNames.push("FUNCTION_NAME", but it doesn't seem to work. THe code is not gettting hit. I think I have the above statement in the wrong location. Do I have to add it within the context editor tags? If so, where? Could your show some sample code? Becuase when I try to add it within those tags, Sharepoint Designer closes with an error. Any help would be appreciated!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7192910.post-7208057851990192822007-07-06T08:07:00.000-05:002007-07-06T08:07:00.000-05:00Mike - Good catch! I've fixed that to say, "here i...Mike - Good catch! I've fixed that to say, "here is a JavaScript snippet that we had used to hide the 'NEW!' icon on a page in WSS v2."Ricky Spearshttps://www.blogger.com/profile/18114053887886617287noreply@blogger.comtag:blogger.com,1999:blog-7192910.post-60404464779263884592007-07-06T06:49:00.000-05:002007-07-06T06:49:00.000-05:00I think your first main paragraph of the text rath...I think your first main paragraph of the text rather than the intro should say WSS 2.0 rather than WSS 3.0.<BR/><BR/>Could you re-check?<BR/><BR/>Mike WalshAnonymousnoreply@blogger.com