Jump to content

Problems with DOTD and Javascript


spyke01

Recommended Posts

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:
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
[/code]
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:
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
[/code]
otherwise the page wil be really screwy i really need some help here, heres the javascript source code:
[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;
}
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.