Jump to content

OnMouseOver popup window in PHP


Dark-Hawk

Recommended Posts

So I'm creating a calendar script 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 right:

 

    	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++;

 

Then for the JavaScript:

<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>

 

And the DIV:

<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>

 

So yeah ... that's what I have and I'm unsure how to get it to what I need... Any help is certainly appreciated.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.