spyke01 Posted May 23, 2006 Share Posted May 23, 2006 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 https://forums.phpfreaks.com/topic/10293-problems-with-dotd-and-javascript/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.