Here it is. The error occurs in the ticker.prototype.rotatemsg
function. (Exact error message is "this.items[this.pointer].attributes
has no properties" on line 44.)
// -------------------------------------------------------------------
// Main Ticker Object function
// ticker(items, tagId, delay, optionalswitch)
// -------------------------------------------------------------------
function ticker (items, tagId, delay, optionalswitch) {
this.items = eval(items); // List of things to cycle through
this.tickerId = tagId; // ID of ticker div to display information
this.delay = delay; // Delay between msg change, in miliseconds.
this.logicswitch = (typeof optionalswitch != "undefined") ?
optionalswitch : -1;
this.mouseoverBool = 0; // Boolean to indicate whether mouse is
currently over ticker (and pause it if it is)
this.pointer = 0;
// var tickerDiv = document.getElementById(this.tickerId);
// tickerDiv.innerHTML = "Initializing ticker…";
this.initialize();
}
// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents and parse it using JavaScript DOM methods
// -------------------------------------------------------------------
ticker.prototype.initialize = function () {
if (this.items.length == 0) { // if no articles found in returned
content
document.getElementById(this.tickerId).innerHTML = "Sorry, there are
no articles to display.";
return;
}
var instanceOfTicker = this;
document.getElementById(this.tickerId).onmouseover = function ()
{instanceOfTicker.mouseoverBool = 1}
document.getElementById(this.tickerId).onmouseout = function ()
{instanceOfTicker.mouseoverBool = 0}
this.rotatemsg();
}
// -------------------------------------------------------------------
// rotatemsg()- Rotate through messages and displays them
// -------------------------------------------------------------------
ticker.prototype.rotatemsg = function () {
var instanceOfTicker = this;
if (this.mouseoverBool == 1) { //if mouse is currently over ticker,
do nothing (pause it)
setTimeout(function () {instanceOfTicker.rotatemsg()}, 100);
} else {
var tickerDiv = document.getElementById(this.tickerId);
var tickerContent = ''<a href="/articles/'' +
this.items[this.pointer].attributes.id + ''">'' +
this.items[this.pointer].attributes.title + ''</a>'';
tickerDiv.innerHTML = tickerContent;
this.pointer = (this.pointer < this.items.length - 1) ? this.pointer
+ 1 : 0;
setTimeout(function () {instanceOfTicker.rotatemsg()}, this.delay) //
update container every second
}
}
Thanks for helping me ferret this out.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---