jonnyno5 Posted October 30, 2008 Share Posted October 30, 2008 im trying to get a text to come up and hover just under a pic on mouse over. whats happening is when u mouse over the pic the text comes up at the top of my page and moves everything down so it can fit in.. can any1 help. hears my code. <? include("game_html.php");$game="yes"; mysql_query("UPDATE $tab[pimp] SET currently='purchasing items' WHERE id='$id' AND rid='$rid'"); $user = mysql_fetch_array(mysql_query("SELECT cash,glock,shotgun,uzi,ak47,streetbike,lowrider,hummer,condom,medicine,crack,weed,thugs,hoehappy,thughappy FROM $tab[pimp] WHERE id='$id' AND rid='$rid';")); $error=""; $transaction=""; if ($buy || $sell) { if ((maxlength($cond) == bad) || (maxlength($medi) == bad) || (maxlength($crac) == bad) || (maxlength($weed) == bad) || (maxlength($stre) == bad) || (maxlength($lowr) == bad) || (maxlength($humm) == bad) || (maxlength($thug) == bad) || (maxlength($gloc) == bad) || (maxlength($shot) == bad) || (maxlength($uzis) == bad) || (maxlength($ak47) == bad)) {$error='<font color="#FFCC00">You cannot buy/sell that amount at a time</font>';} elseif (($cond) && (eregi_replace("([0-9]+)","",$cond)) || ($medi) && (eregi_replace("([0-9]+)","",$medi)) || ($chem) && (eregi_replace("([0-9]+)","",$chem)) || ($thug) && (eregi_replace("([0-9]+)","",$thug)) || ($gloc) && (eregi_replace("([0-9]+)","",$gloc)) || ($shot) && (eregi_replace("([0-9]+)","",$shot)) || ($uzis) && (eregi_replace("([0-9]+)","",$uzis)) || ($ak47) && (eregi_replace("([0-9]+)","",$ak47)) || ($crac) && (eregi_replace("([0-9]+)","",$crac)) || ($weed) && (eregi_replace("([0-9]+)","",$weed)) || ($drug) && (eregi_replace("([0-9]+)","",$drug)) || ($stre) && (eregi_replace("([0-9]+)","",$stre)) || ($lowr) && (eregi_replace("([0-9]+)","",$lowr)) || ($humm) && (eregi_replace("([0-9]+)","",$humm))) { $error='<font color="#FFCC00">No item selected</font><br>'; } else{ if($buy){ $cost=$cond*1+$medi*20+$thug*1000+$gloc*500+$shot*1000+$uzis*2500+$ak47*5000+$crac*10+$weed*5+$stre*500+$lowr*2500+$humm*3000; } elseif($sell){ $cost=$gloc*375+$shot*750+$uzis*1875+$ak47*3750+$lowr*1875+$stre*375+$humm*2250; } if (($buy) && ($cost > $user["cash"])){$error='<font color="#FFCC00">You dont have enough cash.</font><br>';} elseif (($sell) && ($cond)){$error='<font color="#FFCC00">You cannot sell condoms.</font><br>';} elseif (($sell) && ($weed)){$error='<font color="#FFCC00">You cannot sell weed.</font><br>';} elseif (($sell) && ($crac)){$error='<font color="#FFCC00">You cannot sell crack.</font><br>';} elseif (($sell) && ($medi)){$error='<font color="#FFCC00">You cannot sell medicine.</font><br>';} elseif (($sell) && ($thug)){$error='<font color="#FFCC00">You cannot sell thugs.</font><br>';} elseif (($sell) && ($gloc > $user["glock"])){$error='<font color="#FFCC00">You dont have that many glocks.</font><br>';} elseif (($sell) && ($shot > $user["shotgun"])){$error='<font color="#FFCC00">You dont have that many shotguns.</font><br>';} elseif (($sell) && ($uzis > $user["uzi"])){$error='<font color="#FFCC00">You dont have that many uzi's.</font><br>';} elseif (($sell) && ($ak47 > $user["ak47"])){$error='<font color="#FFCC00">You dont have that many ak-47's.</font><br>';} elseif (($sell) && ($stre > $user["streetbike"])){$error='<font color="#FFCC00">You dont have that many street bikes.</font><br>';} elseif (($sell) && ($lowr > $user["lowrider"])){$error='<font color="#FFCC00">You dont have that many lowriders.</font><br>';} elseif (($sell) && ($humm > $user["hummer"])){$error='<font color="#FFCC00">You dont have that many hummers.</font><br>';} else{ if($buy){ $user["cash"] -= $cost;$user["condom"] += $cond;$user["medicine"] += $medi;$user["crack"] += $crac;$user["weed"] += $weed;$user["thugs"] += $thug;$user["glock"] += $gloc;$user["shotgun"] += $shot;$user["uzi"] += $uzis;$user["ak47"] += $ak47;$user["streetbike"] += $stre;$user["lowrider"] += $lowr;$user["hummer"] += $humm; } //$user["chemist"] += $chem;$user["chemical"] += $drug; if($sell){ $user["cash"] += $cost;$user["glock"] -= $gloc;$user["shotgun"] -= $shot;$user["uzi"] -= $uzis;$user["ak47"] -= $ak47;$user["streetbike"] -= $stre;$user["lowrider"] -= $lowr;$user["hummer"] -= $humm; } $user["cash"]=fixinput($user["cash"]);$user["thugs"]=fixinput($user["thugs"]);$user["glock"]=fixinput($user["glock"]);$user["shotgun"]=fixinput($user["shotgun"]);$user["uzi"]=fixinput($user["uzi"]);$user["ak47"]=fixinput($user["ak47"]);$user["condom"]=fixinput($user["condom"]);$user["medicine"]=fixinput($user["medicine"]);$user["crack"]=fixinput($user["crack"]);$user["weed"]=fixinput($user["weed"]);$user["streetbike"]=fixinput($user["streetbike"]);$user["lowrider"]=fixinput($user["lowrider"]);$user["hummer"]=fixinput($user["hummer"]); //$user["chemical"]=fixinput($user["chemical"]);$user["chemist"]=fixinput($user["chemist"]); mysql_query("UPDATE $tab[pimp] SET cash='$user[cash]', condom='$user[condom]', medicine='$user[medicine]', crack='$user[crack]', weed='$user[weed]', thugs='$user[thugs]', glock='$user[glock]', shotgun='$user[shotgun]', uzi='$user[uzi]', ak47='$user[ak47]', streetbike='$user[streetbike]', lowrider='$user[lowrider]', hummer='$user[hummer]' WHERE id='$id' AND rid='$rid'"); $transaction="completed"; } $worth=worth($id);$wappy=hoehappy($id);$tappy=thughappy($id); mysql_query("UPDATE $tab[pimp] SET hoehappy='$wappy', thughappy='$tappy',worth='$worth', online='$time' WHERE id='$id' AND rid='$rid'"); } } $user = mysql_fetch_array(mysql_query("SELECT cash,glock,shotgun,uzi,ak47,streetbike,lowrider,hummer,condom,medicine,crack,weed,thugs,hoehappy,thughappy FROM $tab[pimp] WHERE id='$id' AND rid='$rid';")); secureheader(); ?> <form name="store" method="post" action="purchase.php?rid=<?=$rid?><?if($buying){?>&buying=<?=$buying?><?}elseif($pawn){?>&pawn=<?=$pawn?><?}?>"> <?=$error?> </head> <div id="tooltip"></div> <script type="text/javascript"> <!-- Xoffset= -30; Yoffset= 20; var old,iex=(document.all),yyy=-1000; var ns4=document.layers var ns6=document.getElementById&&!document.all var ie4=document.all document.getElementById("tooltip").style.visibility="visible" document.getElementById("tooltip").style.display="none" document.onmousemove=get_mouse; function popup(msg,width){ var content="<TABLE CELLPADDING=0 CELLSPACING=1 BGCOLOR=000000><TR bgcolor=111111><TD width="+width+"><TABLE><TR><TD>"+msg+"</TD></TR></TABLE></TD></TR></TABLE>"; yyy=Yoffset; document.getElementById("tooltip").innerHTML=content; document.getElementById("tooltip").style.display=''; document.getElementById("tooltip").style.visibility="visible"; } function get_mouse(e){ var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft; document.getElementById("tooltip").style.left=x+Xoffset; var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop; document.getElementById("tooltip").style.top=y+yyy; } function kill(){ yyy=-1000; document.getElementById("tooltip").style.visibility="hidden"; document.getElementById("tooltip").style.display="none"; } //--> </script> <table width="100%" align="center" cellspacing="0" cellpadding="6" border="0"> <tr> <td align="center" valign="top" width="50%"> <table width="98%" cellspacing="0" cellpadding="1"> <tr><td align="center" colspan="6"><font size="+1"><b>mini mart</b></font></td></tr> <tr><td align="center">QTY:</td><td>Item:</td><td align="center">Price:</td><td width="10"> </td><td align="right">Own:</td><td width="10"> </td> <tr bgcolor="#333333"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.cond.value=<?=floor($user["cash"]/1)?>"><input type="text" class="text" size="8" name="cond"></td> <td><font color="#B5CDE6">condom</font></td> <td><font color="#FFCC00">$1</font></td> [code] [/code] <td width="10"> </td> <td align="right"><?=commas($user["condom"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/condom.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#333333"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/1))?></font> condoms</small></td></tr> <tr bgcolor="#666666"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.medi.value=<?=floor($user["cash"]/20)?>"><input type="text" class="text" size="8" maxlength="14" name="medi"></td> <td><font color="#B5CDE6">medicine</font></td> <td><font color="#FFCC00">$20</font></td> <td width="10"> </td> <td align="right"><?=commas($user["medicine"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/meds.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#666666"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/20))?></font> meds</small></td></tr> <tr bgcolor="#333333"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.weed.value=<?=floor($user["cash"]/5)?>"><input type="text" class="text" size="8" maxlength="14" name="weed"></td> <td><font color="#B5CDE6">weed</font></td> <td><font color="#FFCC00">$5</font></td> <td width="10"> </td> <td align="right"><?=commas($user["weed"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/weed.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#333333"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/5))?></font> grams</small></td></tr> <tr bgcolor="#666666"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.crac.value=<?=floor($user["cash"]/10)?>"><input type="text" class="text" size="8" maxlength="14" name="crac"></td> <td><font color="#B5CDE6">crackrock</font></td> <td><font color="#FFCC00">$10</font></td> <td width="10"> </td> <td align="right"><?=commas($user["crack"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/crack.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#666666"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/10))?></font> rocks</small></td></tr> <tr><td align="center" colspan="6"><input type="submit" class="submit" name="buy" value="buy"><br><br></td></tr> <tr><td align="center" colspan="6"><font size="+1"><b>discount auto</b></font></td></tr> <tr><td align="center">QTY:</td><td>Item:</td><td align="center">Price:</td><td width="10"> </td><td align="right">Own:</td><td width="10"> </td> <tr bgcolor="#666666"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.stre.value=<?=floor($user["cash"]/500)?>"><input type="text" class="text" size="8" maxlength="14" name="stre"></td> <td><font color="#B5CDE6">jeep</font></b></td> <td><font color="#FFCC00">$500</font></td> <td width="10"> </td> <td align="right"><?=commas($user["streetbike"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/jeep.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#666666"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/500))?></font> jeeps</small></td></tr> <tr bgcolor="#333333"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.lowr.value=<?=floor($user["cash"]/2500)?>"><input type="text" class="text" size="8" maxlength="14" name="lowr"></td> <td><font color="#B5CDE6">hummer</font></b></td> <td><font color="#FFCC00">$2,500</font></td> <td width="10"> </td> <td align="right"><?=commas($user["lowrider"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/hummer.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#333333"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/2500))?></font> hummers</small></td></tr> <tr bgcolor="#666666"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.humm.value=<?=floor($user["cash"]/3000)?>"><input type="text" class="text" size="8" maxlength="14" name="humm"></td> <td><font color="#B5CDE6">chopper</font></b></td> <td><font color="#FFCC00">$3,000</font></td> <td width="10"> </td> <td align="right"><?=commas($user["hummer"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/chopper.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#666666"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/3000))?></font> choppers</small></td></tr> <tr><td align="center" colspan="6"><input type="submit" class="submit" name="buy" value="purchase"> <input type="submit" class="submit" name="sell" value="sell"></td></tr> </table> <td align="center" valign="top" width="50%"> <table width="98%" cellspacing="0" cellpadding="1"> <tr><td align="center" colspan="6"><font size="+1"><b>arms dealer</b></font></td></tr> <tr><td align="center">QTY:</td><td>Item:</td><td align="center">Price:</td><td width="10"> </td><td align="right">Own:</td><td width="10"> </td> <tr bgcolor="#333333"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.thug.value=<?=floor($user["cash"]/1000)?>"><input type="text" class="text" size="8" maxlength="14" name="thug"></td> <td><font color="#B5CDE6">hire thug</font></td> <td><font color="#FFCC00">$1,000</font></td> <td width="10"> </td> <td align="right"><?=commas($user["thugs"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/thug.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#333333"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/1000))?></font> thugs</small></td></tr> <tr bgcolor="#666666"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.gloc.value=<?=floor($user["cash"]/500)?>"><input type="text" class="text" size="8" maxlength="14" name="gloc"></td> <td><font color="#B5CDE6">glock</font></b></td> <td><font color="#FFCC00">$500</font></td> <td width="10"> </td> <td align="right"><?=commas($user["glock"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/glock.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#666666"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/500))?></font> glocks</small></td></tr> <tr bgcolor="#333333"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.shot.value=<?=floor($user["cash"]/1000)?>"><input type="text" class="text" size="8" maxlength="14" name="shot"></td> <td><font color="#B5CDE6">shotgun</font></td> <td><font color="#FFCC00">$1,000</font></td> <td width="10"> </td> <td align="right"><?=commas($user["shotgun"])?> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/shotgun.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#333333"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/1000))?></font> shotguns</small></td></tr> <tr bgcolor="#666666"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.uzis.value=<?=floor($user["cash"]/2500)?>"><input type="text" class="text" size="8" maxlength="14" name="uzis"></td> <td><font color="#B5CDE6">uzi</font></td> <td><font color="#FFCC00">$2,500</font></td> <td width="10"> </td> <td align="right"><?=commas($user["uzi"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/uzi.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#666666"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/2500))?></font> uzi's</small></td></tr> <tr bgcolor="#333333"> <td rowspan="2" align="center"><input style="font-size: 10px;" type="button" value="MAX" onclick="document.store.ak47.value=<?=floor($user["cash"]/5000)?>"><input type="text" class="text" size="8" maxlength="14" name="ak47"></td> <td><font color="#B5CDE6">ak-47</font></td> <td><font color="#FFCC00">$5,000</font></td> <td width="10"> </td> <td align="right"><?=commas($user["ak47"])?></td> <td width="10"> </td> <td><a href="#" onMouseover="popup('<span class=styleGreen>Thugs</span><br>just like you!')"; onMouseout="kill()"><img src="images/purchaseicons/AK-47.png" width="40" height="40" border="0"></a> </tr> <tr bgcolor="#333333"><td colspan="6"><small>you can afford <font color="#B5CDE6"><?=commas(floatval($user["cash"]/5000))?></font> ak-47's</small></td></tr> <tr><td align="center" colspan="6"><input type="submit" class="submit" name="buy" value="purchase"> <input type="submit" class="submit" name="sell" value="sell"></td></tr> </table> <br> <br> <br><b>You have <font color="#B5CDE6">$<?=commas($user["cash"])?></font> cash on hand.</b> <br>hoe happiness: <font color="#FFCC00"><?=$user["hoehappy"]?>%</font> thug happiness: <font color="#FFCC00"><?=$user["thughappy"]?>%</font> <br> <br><a href="main.php?rid=<?=$rid?>"><font color="#FFFFFF">back to</font> main menu</a><br> <br><a href="purchase.php?sell=sell&gloc=<?=$user[glock]?>&shot=<?=$user[shotgun]?>&uzis=<?=$user[uzi]?>&ak47=<?=$user[ak47]?>&rid=<?=$rid?>">sell all weapons</a><br> <a href="purchase.php?sell=sell&stre=<?=$user[streetbike]?>&lowr=<?=$user[lowrider]?>&humm=<?=$user[hummer]?>&rid=<?=$rid?>">sell all rides</a> </td> </tr> </table> </form> <br> <br> <?=bar()?> <br> <? gamefooter(); if (isset($user)) unset($user); ?> Link to comment https://forums.phpfreaks.com/topic/130802-tooltip-help/ Share on other sites More sharing options...
Maq Posted October 30, 2008 Share Posted October 30, 2008 Sorry, but I don't think anyone is really going to read all that code. You might want to: 1) Post only the relevant code. 2) Elaborate on your issue(s) a little more. 3) Use code tags! (I see you attempted to, but miserably failed!) Link to comment https://forums.phpfreaks.com/topic/130802-tooltip-help/#findComment-678905 Share on other sites More sharing options...
xtopolis Posted October 31, 2008 Share Posted October 31, 2008 Your tooltip div needs to have a position: absolute attribute. You should just be able to apply it to the tag itself: <div id="tooltip" style="position: absolute;"></div> or do it in your stylesheet, the more appropriate way. Link to comment https://forums.phpfreaks.com/topic/130802-tooltip-help/#findComment-679006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.