Jump to content


Photo

Problems with DOTD and Javascript


  • Please log in to reply
No replies to this topic

#1 spyke01

spyke01
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 23 May 2006 - 08:21 PM

hi guys, got a bit of a problem, i have a store scipt that utilizes a div that scrolls down the page with you, the problem is if i dont use this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Then the box will not move with the page, this was an ok hack for a short time, but my new page layout requires me to use this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
otherwise the page wil be really screwy i really need some help here, heres the javascript source code:
function SetDiagramPosition() 
{            
    var xPos;
    var yStart;
    var yPos;
    var yInc;
    
    if (IsNetScapeBrowser()) {
    
            xPos = window.pageXOffset + window.innerWidth - 145;

            var yHeight = document.getElementById ("PriceBox_Layer").clientHeight;
            if (yHeight == 0)
                yHeight = 128;
            yPos = window.pageYOffset + window.innerHeight - yHeight - 150;
            
                yStart = document.getElementById("PriceBox_Layer").style.top;            
                yInc = Math.log(Math.pow(yPos - yStart, 3));
                
                if (yStart + yInc >= yPos)
                    yStart = yPos;
                else if (yStart < yPos)    
                    yStart += yInc;
                else
                    yStart = yPos;        

            
            document.getElementById("PriceBox_Layer").style.top = yStart;
            document.getElementById("PriceBox_Layer").style.left = xPos;

    }
    else {

            xPos = document.body.scrollLeft + window.document.body.clientWidth - 125;            
            yPos = document.body.scrollTop + window.document.body.clientHeight - PriceBox_Layer.clientHeight - 150;
            
            
                yStart = PriceBox_Layer.style.pixelTop;        
                yInc = Math.log(Math.pow(yPos - yStart, 3));        
                if (yStart + yInc >= yPos)
                    yStart = yPos;
                else if (yStart < yPos)    
                    yStart += yInc;
                else
                    yStart = yPos;        
            
            
            PriceBox_Layer.style.pixelTop  = yStart;
            PriceBox_Layer.style.pixelLeft = xPos;
            

    }
    
    var nTimeOut = 10;
    setTimeout('SetDiagramPosition()', nTimeOut);

}


function IsNetScapeBrowser() 
{
    return !document.all;
}


[a href="http://www.fasttracksites.com" target="_blank"]Cheap PHP Hosting[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users