The below code does not work when I'm trying to call window.scroll():
CODE
<script>
function pageScroll() {
document.getElementById('debug').innerHTML += '<div>scrolling...</div>';
window.scrollBy(0,50); // horizontal and vertical scroll increments
scrolldelay = setTimeout('pageScroll()',100); // scrolls every 100 milliseconds
}
function initCanvas() {
document.getElementById('debug').innerHTML += '<div>about to scroll</div>';
window.scroll(0,200);
document.getElementById('debug').innerHTML += '<div>finished scrolling</div>';
document.getElementById('debug').innerHTML += '<div>now try timed scrolling</div>';
pageScroll();
}
gadgets.util.registerOnLoadHandler(initCanvas);
</script>
<!-- VIEW Content -->
<div style="text-align:left;margin: 0px 10px 10px 5px; padding: 4px; font-size: 12px;">
<p style="font-size: 10pt;">Millions of cats and kittens are abandoned to shelters. These innocent pets are hungry, overcrowded, and often given only a few months to live before being euthanized.
We've set up a quick and easy way for you to help them.
</p>
<p>
Simply add one of the pictures of the beautiful shelter cats below to your profile, and then <b>click on them whenever you have a few minutes</b>.
You'll be taken to a <a href="http://www.experienceproject.com/savecats/" target="_blank">fun trivia game</a> where <b>every right answer feeds a shelter cat one kibble of food</b>. By putting it on your profile, you're raising awareness about these
cats and encouraging your friends to help feed them too!
</p>
<p>
To find more pet lovers, please visit <a href="http://www.experienceproject.com" target="_blank">Experience Project</a>.
</p>
</div>
<div id="pet_chosen"></div>
<div id="debug"></div>
<div style="text-align:center;">
<form id="pet_form" name="pet_form">
<div id="pet_choices"></div>
</form>
</div>
Here is the error I'm getting in firebug:
[Exception... "'TypeError: callMethod: [object Object] has no method scroll' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]
getXY()()combo?2....on-min.js (line 9)
getXY()([ proto___=Object concat_grantCall___=true], "click", function())combo?2....on-min.js (line 8)
getXY()(undefined, undefined, undefined, undefined, undefined)combo?2....on-min.js (line 8)
art()()combo?/c...v6nPA-.js (line 2)
art()()combo?/c...v6nPA-.js (line 2)
getXY()()combo?2....on-min.js (line 8)
getXY()(DOMContentLoaded )combo?2....on-min.js (line 9)
[Break on this error] },getXY:function(K){return[this.getPageX...U=YAHOO.util.Event;EU.on=EU.addListen
er;