1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Scroll reversal issue

Discussion in 'JavaScript' started by tendlich, Aug 31, 2007.

  1. #1
    I am trying to change a javascript on my web page, but i have to admit i have never done anything with java before. I had a guy publish this site www.gototodd.com for me awhile ago and he has since gone MIA.

    Anyway, if anyone can help me with something that seems simple enough, but i can't seem to figure out.

    The scroll box on the left side scrolls up and i would like to change it to scroll down.

    Any help would be greatly appreciated.

    Here is the script:
    <!-- Begin
    var contentobj = null;
    var contentheight = null;
    var iens6=document.all||document.getElementById
    var ns4=document.layers
    var scrollspeed = 30

    function GetObj(name) {
    if (document.getElementById) return document.getElementById(name);
    else if (document.all) return document.all[name];
    else if (document.layers) return document.layers[name];
    return null;
    }

    function scrollup() {
    if (contentobj == null) getcontent_height();
    if(window.scrolltimerdown) clearTimeout(scrolltimerdown);

    if(iens6) {
    if (parseInt(contentobj.style.top)>=(contentheight*(-1)+100)) {
    contentobj.style.top=parseInt(contentobj.style.top)-step
    }
    else {
    shifttotop()
    }
    }
    else {
    if(ns4) {
    if (contentobj.top>=(contentheight*(-1)+100)) {
    contentobj.top-=step
    }
    else {
    shifttotop()
    }
    }
    }
    scrolltimerdown = setTimeout("scrollup()",scrollspeed)
    }

    <!-- function to stop all scroll timers -->
    function stopall() {
    if(window.scrolltimerup) clearTimeout(scrolltimerup);
    if(window.scrolltimerdown) clearTimeout(scrolltimerdown);
    }

    <!-- function that shifts the object to top -->
    function shifttotop(){
    stopall();
    if (iens6) contentobj.style.top = 0;
    else contentobj.top=0;
    }

    function getcontent_height(){
    if (iens6) {
    contentobj = GetObj("content");
    contentheight = contentobj.offsetHeight
    }
    }

    window.onload=scrollup
    // End -->
     
    tendlich, Aug 31, 2007 IP