Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

PHP & Javascript

Aloittaja whitta, huhtikuu 23, 2007, 01:25:32 IP

« edellinen - seuraava »

whitta

I want to create a page that gives me a dropdown box written in javascript,  but populated from my SQL db. Is this a possibility? I have it set up now so that the JavaScript & php are on the same page..the page loads w/no errrors but when i mouseover what i want to dropdown..nothing. Here is what i have..i know something is wrong..I'm prolly way off track

<link href="../legends.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.Menu {visibility: hidden}
</style>
<script src="roster.js" type="text/javascript"></script>
<script type="text/javascript">
   var ActiveMenu=null;
   function hideActive() {
    if (ActiveMenu !== null) {
      hideIt(ActiveMenu);
      ActiveMenu=null;
   }
}
   function popMenu(M) {
     hideActive();
        ActiveMenu = document.getElementById(M);
     if (ActiveMenu.filters) ActiveMenu.filters[1].apply();
      showIt(ActiveMenu);
      if (ActiveMenu.filters) ActiveMenu.filters[1].play(0.5);
}
<script src="roster.js" type="text/javascript"></script>
<a href="javascript:attach_file( 'javascript.php' )"></a>

<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center" background="../images/background.jpg">
   <tr>
      <td align="left" valign="top"><img src="../images/fillin.jpg" alt="Gryphon" /></td>
        <td colspan="2" align="center" valign="top"><img src="../images/LegendsHeader.jpg" alt="Legends" /></td>
        <td align="right" valign="top"><img src="../images/fillin.jpg" alt="Gryphon" width="190" height="150" /></td>
   </tr>

   
  <?
$id=$_POST["id"];

$DBConnect = @mysql_connect("localhost", "winniethepooh", "password") or die ("No Connection");
@mysql_select_db("winniwthepooh_roster",$DBConnect) or die ("Database Not Found");
$SQLstring = "SELECT * FROM list";
$QueryResult=@mysql_query($SQLstring,$DBConnect);?>
  <?
while($Row=@mysql_fetch_array($QueryResult))
{ ?>
  <tr>
 
  <td colspan="4" onMouseOver="hideActive()">
    <? echo "<font color='#FFFF66'>Character Name:</font>&nbsp;&nbsp;<font color='#FFFFFF'><a href='JavaScript:popMenu('charMenu')'>". $Row["charName"] . "</a></font><br />"; ?>
 
  <div id="charMenu" class="Menu">
   <?   echo $Row['class']; ?>
   <? echo $Row['level']; ?>
   <? echo $Row['professions'];?>
   <? echo $Row['levels'];?>   
   
   <form action="delete_apply.php" method="get">
   <input name="id" type="hidden" value="<? echo $Row['id']; ?>"  />
   <p>
    <input name="charName"  type="hidden" value="<? echo $Row['charName']; ?>"  />
     <input type="hidden" name="class" value="<? echo $Row['class']; ?>" />
   <input type="hidden" name="level" value="<? echo $Row['level']; ?>" />
   <input type="hidden" name="professions" value="<? echo $Row['professions']; ?>" />
   <input type="hidden" name="levels" value="<? echo $Row['age']; ?>" />
   </p>
   </form>
   </div>
   </td>

<? }
echo"<br /><br />";
@mysql_free_result($QueryResult);
@mysql_close($DBConnect);


?>
</tr>
<tr>
<td colspan="4">
<div id="links">
<p align="center" style="color:#FFFFFF"> Click <a href="../admin/admin_update.html">here</a> to return to adim home page.</p>
</div> </td>
</tr>
</table>


Advertisement: