Hi,
I'm trying to control my rotator from JavaScript code. Everything works fine on FF and Chrome, and when i try on IE 8 I get the following JavaScript error (Message: 'null' is null or not an object). below is my JavaScript code,
function startUpScripts() { |
var newsTickerRotator = $find('<%= newsTickerRotator.ClientID %>'); |
newsTickerRotator.repaint(); |
newsTickerRotator.add_mouseOver(newsTickerMouseOver); |
newsTickerRotator.add_mouseOut(newsTickerMouseOut); |
startRotator(newsTickerRotator, Telerik.Web.UI.RotatorScrollDirection.Right); |
} |
function newsTickerMouseOver() { |
stopRotator($find('<%= newsTickerRotator.ClientID %>')); |
} |
function newsTickerMouseOut() { |
startRotator($find('<%= newsTickerRotator.ClientID %>'), Telerik.Web.UI.RotatorScrollDirection.Right); |
} |
function startRotator(rotator, direction) { |
if (!rotator.autoIntervalID) { |
rotator.autoIntervalID = window.setInterval(function() { |
rotator.showNext(direction); |
}, rotator.get_frameDuration()); |
} |
} |
function stopRotator(rotator) { |
if (rotator.autoIntervalID) { |
window.clearInterval(rotator.autoIntervalID); |
rotator.autoIntervalID = null; |
} |
} |
function showNextItem(rotator, direction) { |
rotator.showNext(direction); |
} |
I also added the following code to the body tag in order to run my rotator on page load (<body onload="startUpScripts();" >). If I refresh IE it works fine, but if I open it for the first time I get the error. I'm really wondering if JQuery ready events runs before the rotator is rendered!!!!!
Appreciates your help.