Jump to content

Page scrolls to the right for miles!


SirChick

Recommended Posts

I have attatched a picture to show you what is showing on my page. As you can see from the horizontal scroll bar... i can scroll for miles accross...

 

nothing is visible but if i highlight all as shown in the picture there is an invisible line going across.... ive not seen it before but i know what code is creating but i do not know why or what part of the script is causing it.. has any one see it before?

 

Any way this is the script causing it..the script does work without errors and it does what its meant to except for this strange invisible line:

<?

include ("include.php");




$Level = $row["Level"];
$Money = $row["MoneyInHand"];
$Donator = $row["Donator"];
$Networth = $row["networth"];




//set max energy
If ($Donator = 1) {
$row["MaxEnergy"] = 250;
}Else{
$row["MaxEnergy"] = 100;
}



//setting max courage
$EXP = $row["CrimeExp"];



?>



<div id='bv_' style='position:absolute;left:30px;top:118px;width:200px;height:19px;z-index:12' align='center'>
<font style='font-size:14px' color='#FFFFFF' face='Arial'><b>Level:<font color='#32CD32'> <?= $Level?></b></font></div>
<div id='bv_' style='position:absolute;left:145px;top:118px;width:200px;height:19px;z-index:12' align='center'>
<font style='font-size:14px' color='#FFFFFF' face='Arial'><b>Money: <font color='#32CD32'>£<?= $Money?></b></font></div>
<img src="energymax.jpg" id="Image2" alt="" align="top" border="0" width="125" height="5" style="position:absolute;left:380px;top:130px;z-index:1">


<?
//Energy Bar for user
$MaxEnergy = $row["MaxEnergy"];
$CurrentEnergy = $row["CurrentEnergy"];

$height = 5;
$width = 125;

$NewCurrentEnergy = ($CurrentEnergy / $MaxEnergy) * $width;
echo "<div id='bv_' style='position:absolute;left:340px;top:115px;width:200px;height:19px;z-index:12' align='center'>";
echo "<font style='font-size:12px' color='#FFFFFF' face='Arial'><b>Energy $CurrentEnergy/$MaxEnergy</b></font></div>";
echo "<img src='energycurrent.jpg' id='Image2' alt='' align='top' border='0' width='.$NewCurrentEnergy.'height='5' style='position:absolute;left:380px;top:130px;z-index:1'>";
?>


<img src="couragemax.jpg" id="Image2" alt="" align="top" border="0" width="125" height="5" style="position:absolute;left:580px;top:130px;z-index:1">




<?
//courage bar for user

$MaxCourage = $row["MaxCourage"];
$CurrentCourage = $row["CurrentCourage"];

$height = 5;
$width = 125;

$NewCurrentCourage = ($CurrentCourage / $MaxCourage) * $width;
echo "<div id='bv_' style='position:absolute;left:543px;top:115px;width:200px;height:19px;z-index:12' align='center'>";
echo "<font style='font-size:12px' color='#FFFFFF' face='Arial'><b>Courage $CurrentCourage/$MaxCourage</b></font></div>";
echo "<img src='currentcourage.jpg' id='Image2' alt='' align='top' border='0' width='.$NewCurrentCourage.'height='5' style='position:absolute;left:580px;top:130px;z-index:1'>";
?>
<img src="maxhappy.jpg" id="Image2" alt="" align="top" border="0" width="125" height="5" style="position:absolute;left:780px;top:130px;z-index:1">


<?


//happy bar for user



$HouseType = $houserow["HouseType"];




$MaxHappy = $row["MaxHappy"];
$CurrentHappy = $row["CurrentHappy"];


$height = 5;
$width = 125;

$NewCurrentHappy = ($CurrentHappy / $MaxHappy) * $width;
echo "<div id='bv_' style='position:absolute;left:740px;top:115px;width:200px;height:19px;z-index:12' align='center'>";
echo "<font style='font-size:12px' color='#FFFFFF' face='Arial'><b>Happy $CurrentHappy/$MaxHappy</b></font></div>";
echo "<img src='currenthappy.jpg' id='Image2' alt='' align='top' border='0' width='.$NewCurrentHappy.'height='5' style='position:absolute;left:780px;top:130px;z-index:1'>";
?>

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/72607-page-scrolls-to-the-right-for-miles/
Share on other sites

I have fine tuned the code. Its only these 3 lines causing it:

 

 

echo "<div id='bv3' style='position:absolute;left:340px;top:115px;width:150px;height:19px;z-index:12' align='center'>";
echo "<font style='font-size:12px' color='#FFFFFF' face='Arial'><b>Energy $CurrentEnergy/$MaxEnergy</b></font></div>";
echo "<img src='energycurrent.jpg' id='Image2' alt='' align='top' border='0' width='.$NewCurrentEnergy.'height='5' style='position:absolute;left:380px;top:130px;z-index:1'>";

try echoing $NEWCURRENTENERGY and see what its value is, cause that may be the unusually high value, I notice is is being multiplied by width...  ?? 

 

$NewCurrentEnergy = ($CurrentEnergy / $MaxEnergy) * $width;

 

Maybe try...?

 

$NewCurrentEnergy = ($CurrentEnergy / $MaxEnergy) % $width;

 

use % says "MAX" in mathml I believe...  This might make the bar too smal though, tell me what it does ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.