So I'm creating a calendar script in PHP and I want people to be able to mouse over the cells and and have a div/popup window come up that lets them enter some information to sign up for something on the date. What I have thus far is this, but it's not really quite right:
Then for the JavaScript:
And the DIV:
So yeah ... that's what I have and I'm unsure how to get it to what I need... Any help is certainly appreciated.
PHP Code:
if ($the_day != " ");
{
echo "<a href= '#' id='hoverover' style='cursor:pointer;' onMouseOver='ShowPopup(this);' onMouseOut='HidePopup();'>";
echo "$the_day";
echo '</a>';
echo "\n";
}$the_day++;
PHP Code:
<script type='text/javascript'>
function ShowPopup(hoveritem)
{
hp = document.getElementById('hoverpopup');
// Set popup to visible
hp.style.top = hoveritem.offsetTop + 18;
hp.style.left = hoveritem.offsetLeft + 20;
hp.style.visibility = 'Visible';
}
function HidePopup()
{
hp = document.getElementById('hoverpopup');
hp.style.visibility = 'Hidden';
}
</script>
PHP Code:
<div id='hoverpopup' style='visibility:hidden; position:absolute; top:0; left:0;'>
<table bgcolor='#0000FF'>
<tr><td><font color='#FFFFFF'>This is my popup</font></td></tr>
<tr><td bgcolor='#8888FF'>Hello I am a popup table</td></tr>
</table>
</div>
Comment