mysticaljoey
asked on
dynamic content pop up
hi i don't know if this would be the right section to ask this question cos it sounded more JS then php.
I have afew links of vessel name. i want to be able to move my mouse over it and a pop up will appear showing me details of the vessel.
the detail are extracted from mysql.
The pop up willl close when i move my mouse away from the link.
please help
I have afew links of vessel name. i want to be able to move my mouse over it and a pop up will appear showing me details of the vessel.
the detail are extracted from mysql.
The pop up willl close when i move my mouse away from the link.
please help
Here are two references to the manual that you will need for information about outputting the results returned from the query:
http://www.php.net/manual/en/function.mysql-result.php
and:
http://www.php.net/manual/en/function.mysql-fetch-assoc.php
Both include examples of use.
http://www.php.net/manual/en/function.mysql-result.php
and:
http://www.php.net/manual/en/function.mysql-fetch-assoc.php
Both include examples of use.
As quite a lot of browsers support popupblocking, you could consider using absolute positioned popup divs instead. These are hidden and will be shown using javascript. Another things is that these kind of webpages can easily be generated using php/mysql.
regards
-r-
example: (vesseldetails-divs are not absolutely position yet, but this example just shows hiding/unhiding)
<html>
<head>
<script type="text/javascript">
function showDetails(detailid)
{
var elems = document.getElementsByTagN ame('div') ;
for(i = 0; i < elems.length; i++)
{
if(elems[i].className == 'vesseldetails')
{
elems[i].style.display = (elems[i].id == detailid ? '' : 'none');
}
}
return false;
}
</script>
</head>
<body>
<div><button onclick="return showDetails('ves1');">Vess el 1</button></div>
<div><button onclick="return showDetails('ves2');">Vess el 2</button></div>
<div><button onclick="return showDetails('ves3');">Vess el 3</button></div>
<div class="vesseldetails" id="ves1" style="display:none;">v1</ div>
<div class="vesseldetails" id="ves2" style="display:none;">v2</ div>
<div class="vesseldetails" id="ves3" style="display:none;">v3</ div>
</body>
</html>
regards
-r-
example: (vesseldetails-divs are not absolutely position yet, but this example just shows hiding/unhiding)
<html>
<head>
<script type="text/javascript">
function showDetails(detailid)
{
var elems = document.getElementsByTagN
for(i = 0; i < elems.length; i++)
{
if(elems[i].className == 'vesseldetails')
{
elems[i].style.display = (elems[i].id == detailid ? '' : 'none');
}
}
return false;
}
</script>
</head>
<body>
<div><button onclick="return showDetails('ves1');">Vess
<div><button onclick="return showDetails('ves2');">Vess
<div><button onclick="return showDetails('ves3');">Vess
<div class="vesseldetails" id="ves1" style="display:none;">v1</
<div class="vesseldetails" id="ves2" style="display:none;">v2</
<div class="vesseldetails" id="ves3" style="display:none;">v3</
</body>
</html>
you can use plain css to accomplish that, without an scripting, see
http://www.madaboutstyle.com/tooltip2.html
http://www.madaboutstyle.com/tooltip2.html
As it concerns a popup with possible some interactive content, or content which users might want to copy, css is a nice solution, but not sufficient as the popup disappears when you want to move your mouse onto it.
-r-
-r-
[quote]...to move my mouse over it and a pop up will appear showing me details of the vessel.
the detail are extracted from mysql.
The pop up willl close when i move my mouse away from the link.[/quote]
CSS is perfect for those requirements.
using the madaboutstyle example, tha code would look like
<?php
while ($row=mysql_fetch_row($res ult)){
echo "<a href=\"{$row['link']}\" class="info">{$row['name'] }<span>{$r ow['detail s']}</span ></a><br>\ n";
}
the detail are extracted from mysql.
The pop up willl close when i move my mouse away from the link.[/quote]
CSS is perfect for those requirements.
using the madaboutstyle example, tha code would look like
<?php
while ($row=mysql_fetch_row($res
echo "<a href=\"{$row['link']}\" class="info">{$row['name']
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is the example of a static link with a tool tip (from the link):
<a href="http://site.com" onMouseover="ddrivetip('Ja
To make it dynamic, you could do this:
<?php
$conn = mysql_connect("host","user
mysql_select_db("db_name",
$query = "SELECT * FROM tablename";
$query = mysql_query($query) or die(mysql_error());
//now you have the results returned from the query you can use various methods to
//output them example: taking a field from the first row returned
$output = mysql_result($query,0,"fie
?>
<a href="http://site.com" onMouseover="ddrivetip('<?