Click here to Skip to main content
15,886,815 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi i need some help in my JavaScript code
i currently have deployed a Javascript code to set up alerts on my SharePoint site telling people about IT updates.
i have 2 banners deployed, orange meaning update coming up, and a red banner indicating update in progress. and setting the time for banners to change in the JavaScript. I have linked to the javascript from Sharepoint Designer. The script works in Google Chrome, however it doesnt work in Internet Explorer version 9 or 11.
this is the code:

/* This script and many more are available free online at
The JavaScript Source!! http://www.javascriptsource.com
Created by: Anonymous | http://musikimiz.googlepages.comLicensed under: Creative Commons License
*/


function pixTimeChange() {
var t=new Date();
var h = t.getHours();
var r1="link to banner1";
var r2="link to banner 2";
var el=document.getElementById('myimage');

// See the time below. Note: The time is in 24 hour format.
// In the example here, "7" = 7 AM; "17" =5PM.
el.src = (h>=10 && h<15) ? r1 : r2;
}

// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.>


and this is the java link i have put in Designer:

<script type="text/javascript" src="timePictureChange.js"></script>

Credit goes to this page: http://www.javascriptsource.com/time-date/time-of-day-picture-change.html[^]

is there a way to make this work in Internet Explorer?
meta is currently set to : <meta http-equiv="X-UA-Compatible" content="IE=8"/>
I have tried to change the settings but when i do i have issues with the scrollbar
It is the script that Internet Explorer doesn't like
Thanks for your help on this.
Posted
Updated 12-Dec-14 0:19am
v2
Comments
vbmike 12-Dec-14 8:30am    
Does the script work in a normal html crafted page outside of sharepoint in IE? Just make a plain html page, add your scripting, see if it works in IE. It may make it easier to debug that way also.
Member 11305708 12-Dec-14 9:35am    
Thanks for your help
i will test it off SharePoint and let you know
Just a bit weird how it works on Chrome but not IE
vbmike 12-Dec-14 10:01am    
My experience is: it is sharepoint, not IE. Sharepoint does stuff for you that it thinks you need when you dont want it to. you have to play with it continuously.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900