Jump to content

creating an onmouseover popup window


Canadiengland

Recommended Posts

how would i go about doing this in php?

ideally, the popup would not be resizeable, and contain info taken from my db

 

something like

 

Name: $name

Attack: $power

 

if anyone has an example script for me to look at id be very thankful, or if youve got hints to push me in the right direction then those are good too! thanks!

 

Link to comment
Share on other sites

ok, but how would i put that into php? seperately print everything?

 

Hard to answer such a weirdly phrased and incomplete question.

 

I suspect what you want is a 'tooltip' not a pop-up window.  Also javascript/html, also findable on Google

Link to comment
Share on other sites

Hello AndyB,

 

  What I am after is the ability to "mouseover" and display a couple of the fields from a table for player scores/ratings etc.

 

  Could you please point me in the proper direction?

 

  Also, thx webskoken for the above link.

 

jim

Link to comment
Share on other sites

onmouseover occurs on the client side (in the browser); database retrieval by php occurs on the server.  You can either retrieve all of the information you want displayed and send it to the browser (incorporated into the html and displayed on mouse over) or leave the page and execute a php script in a new window (a pop-up, for example).

 

Unless you have an enormous amount of data and an enormous number of things that can be moused_over, doing it all in the same html may be simplest.  That would be using a 'tool tip'.

Link to comment
Share on other sites

Andy, ty for the reply... Already have the "new window" pulling the data onClick, and I feel stupid...as I should have realized to just incorporate into the HTML... but said to myself "I don't want it displayed"...  yet didn't think thru.

 

  I guess my head just stumbled again, as how will it not be displayed?...  Only mouse overs I have done have been canned-entries from an HTML editor, and I've never broke down the code...and in these cases...hadn't pulled anything from a database.

 

 

  Ever looked at so much...and go brain dead?  The older I get...the more it seems to happen anymore.  lol

 

Thx...Jim

Link to comment
Share on other sites

  • 3 weeks later...

Hi Guys

 

I've been working on a new "facelift" for our site.  Trying to do the "CSS Style" that I've been reading about in another topic.  Right now I'm using table layout mode.

Our options for products are fragrances, 45 of them now.  I am using the overlibmws pop-ups for descriptions.  Everytime we added one I had to do the "cut & paste" thing to move everything around to keep them in Alphabetical order.  This got to be a pain.  We have a php shopping cart program that uses MySQL which has a sort order that does this anyway for our dropdowns on the products page.  I edited the Options program where you put the options in, creating 3 more fields fragrance description, Caption text and image src.  Did this on the database as well.  Right now theres 4 columns and 13 rows all div boxes.  I have a column variable that counts the column your in.  If your in the 1st, then the popup is on top right of curser.  If your in either 2 middle columns then popup is centered top middle.  If your on the last one then its to the left.

 

The site still has the old table layout its at http://www.candlesbythecreek.com/fragcolors.php  the new page is http://www.candlesbythecreek.com/frag_colors.php  This page looks good in IE-6 fair in Mozilla.  Still working on that though :(

 

Heres the code:

 

<?php
$conn = mysql_connect("localhost", "username", "password");

if (!$conn) {
   echo "Unable to connect to DB: " . mysql_error();
   exit;
}

if (!mysql_select_db("database")) {
   echo "Unable to select Database: " . mysql_error();
   exit;
}

$sql = "SELECT option_Name, option_OLDescription, option_OLCaption, option_Frag_Img
       FROM  tbl_skuoptions
						WHERE option_Archive = 0
       ORDER BY option_Sort";

$result = mysql_query($sql);

if (!$result) {
   echo "Could not successfully run query ";
   exit;
}

if (mysql_num_rows($result) == 0) {
   echo "No rows found, nothing to print so I am exiting";
   exit;
}
$column_cnt = "0";
while ($row = mysql_fetch_assoc($result)) {
	if ($column_cnt == 0 ){ //This checks to see it your on the 1st column, if so put pop-up to right top of curser and increment column_cnt
			$column_cnt++ ;?>
			<div class="fragdescbox">
			<div class="imgbox"><img src="<?php echo $row["option_Frag_Img"];?>" width="35" height="44"></div>
			<div class="descbox"><a href="javascript:void(0);" class="desclinks"onMouseOver="return overlib('<?php echo $row["option_OLDescription"];?>', CAPTION, '<?php echo $row["option_OLCaption"] ;?>',ol_width = 350, ol_hpos = RIGHT, ABOVE);"onMouseOut="nd();"><?php echo $row["option_Name"]; ?></a></div>
			</div> 
<?php 
}elseif ($column_cnt < 3 ){// If on 2nd or 3rd column then put pop-up to center top of curser and increment column_cnt
			$column_cnt++ ;?>			
			<div class="fragdescbox">
			<div class="imgbox"><img src="<?php echo $row["option_Frag_Img"];?>" width="35" height="44"></div>
			<div class="descbox"><a href="javascript:void(0);" class="desclinks"onMouseOver="return overlib('<?php echo $row["option_OLDescription"];?>', CAPTION, '<?php echo $row["option_OLCaption"] ;?>',ol_width = 350, ol_hpos = CENTER, ABOVE);"onMouseOut="nd();"><?php echo $row["option_Name"]; ?></a></div>
			</div>
<?php
}else{// Must be the last column so place popup to left of curser and reset column_cnt
				$column_cnt = "0" ;?>			
				<div class="fragdescbox">
				<div class="imgbox"><img src="<?php echo $row["option_Frag_Img"];?>" width="35" height="44"></div>
				<div class="descbox"><a href="javascript:void(0);" class="desclinks"onMouseOver="return overlib('<?php echo $row["option_OLDescription"];?>', CAPTION, '<?php echo $row["option_OLCaption"] ;?>',ol_width = 350, ol_hpos = LEFT, ABOVE);"onMouseOut="nd();"><?php echo $row["option_Name"]; ?></a></div>
				</div>
<?php
}	
}
mysql_free_result($result);

?> 

 

I have no idea why the code looks like crap at least it did when I previewed.

Didn't know if anybody is interested or not, just thought I'd throw this in the ring.

 

Websmoken

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.