<?php
function popup_header()
{
?>
<style type="text/css">
body { font-family: arial, verdana, sans serif; }
#popup {
position: absolute;
padding: 5px;
border: 1px solid black;
background: #fff;
left: 0px;
top: 0px;
visibility: hidden;
width: 500px;
}
</style>
<script>
function popup( id, info )
{
var obj = document.getElementById( id );
var popup = document.getElementById( 'popup' );
if ( popup.style.visibility == 'visible' )
{
popup.style.visibility = 'hidden';
}
else
{
popup.innerHTML = info;
popup.style.left = obj.offsetLeft + "px";
popup.style.top = ( obj.offsetTop + 20 ) + "px";
popup.style.visibility = 'visible';
}
}
</script>
<?php
}
function popup( $id, $text, $info, $sexuality, $image)
{
?>
<a href="javascript:popup('<?php echo($id) ?>','<?php echo($info); echo($sexuality); echo($image); ?>')"
id="<?php echo($id) ?>"><?php echo $text ?></a>
<?php
}
?>
<?php popup_header(); ?>
<div id="popup">
</div>
<?php
$name = "<b>Name</b>: Jamie<br>";
$sexuality = "<b>Sexuality: </b> Straight<br>";
$image = "<img src=\".\images\meohrly.png\">";
popup( '1', 'News',"$name", "$sexuality", $image ) ?>
Now, i can't get the image to display, the link displays as:
')" id="1">Member
and the link is:
javascript:popup('1','<b>Name</b>: Jamie<br><b>Sexuality: </b> Straight<br><img src=
which is wrong. I think it's because imr src has "" in side of the string, and javascript isn't reading it correctly.
It displays popup with text fine though, just won't display an image.
Any function i can use to fix this?
Cheers.