JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 11th, 2012, 02:50 PM
Naimathullah Naimathullah is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 2 Naimathullah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 58 sec
Reputation Power: 0
PHP5 - Need Help for onmouseover in PHP

I am bringing four pictures from the database and want to show the name when the mouse is moved over to the picture using onmouseover.

This is my javascript:

<script>

function showcontact(element)
{
var contactdiv = document.getElementById('contactdiv');



x = element.offsetLeft;
y = element.offsetTop;

contactdiv.style.left = x + 170;
contactdiv.style.top = y + 30;

contactdiv.style.visibility = 'visible';
}


function hidecontact()
{
var contactdiv = document.getElementById('contactdiv');
contactdiv.style.visibility = 'hidden';
}


</script>


and in my PHP program:

print "<p><img src='images/".$image_file."' onMouseOver = showcontact('this','".$lastname."') onmouseout = hidecontact(this)>";

It would be great if anyone can help me out ....
Code:
code

Reply With Quote
  #2  
Old September 11th, 2012, 02:59 PM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,809 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 18 h 6 m 48 sec
Reputation Power: 6112
Is there any particular thing you need help with? I don't see a question or an error message. Do you debug JS in firebug or chrome debugger?
__________________
HEY! YOU! Read the New User Guide and Forum Rules

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

Reply With Quote
  #3  
Old September 11th, 2012, 03:15 PM
Naimathullah Naimathullah is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 2 Naimathullah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by ManiacDan
Is there any particular thing you need help with? I don't see a question or an error message. Do you debug JS in firebug or chrome debugger?



I want to show name, phone and email when someone moves the mouse over the picture. I dont how to do that. I am new to Javascript. Below is my complete program.
Code:

<HTML>
  <HEAD>
    <TITLE> KINGS WEBSITE </TITLE>
    <link rel = "stylesheet" type="text/css" href="css/basic_004.css" />

    <style>
		#contactdiv
		{
			position: absolute;
			left: 100px;
			top: 100px;
			width: 100px:
			height: 20px;
			padding: 5px;
			background-color: red;
			visibility: hidden;
		}

	</style>


    <script>

   function showcontact(element)
	{
				var contactdiv = document.getElementById('contactdiv');



				x = element.offsetLeft;
				y = element.offsetTop;

				contactdiv.style.left = x + 170;
				contactdiv.style.top = y + 30;

				contactdiv.style.visibility = 'visible';
			}


			function hidecontact()
			{
				var contactdiv = document.getElementById('contactdiv');
				contactdiv.style.visibility = 'hidden';
			}


       </script>
  </HEAD>

  <body>

  <!-- Adding Image  -->

	  <img src = "KingLogo.jpg" width ="576" height= "87">

 <div id = "FeatureHouse">

  <?php
   print " <p><strong><h3> Featured Home! </strong> </h3> </p>";

  	     print "<p><img src='/images/house_mallard_1.jpg'></p>\n";
  	     print "<p> <h3> <strong> Won't last long at this price! </p> </h3> </strong>";
  	     print "<p> <br /> Enjoy the quiet in this Mallard Manor home.
                    Lovely garden views and a short walk to the
                    golf course for those who can't get enough
                    of green living.
                <p>";

     ?>
   </div>

    <div id = "findCity">
	   <Form method = "Post" action="Assignment_8_HouseList.php">
	   Enter City:
	              <input type = " text" name="findCity" size="30">

	     <p> (Leave blank to find all houses listed) </p>

	              <input type = "Submit" value = "Find City">

	    <p> Note: We represent homes in the following cities: OceanCove, Tomsville, Pine Beach  </p>
  </div>
<!--  <div id="validusers">
    </div>

    <div id="errordiv" style="color: red;">
</div>  -->

<!  *********************************  -->
<!   Displaying Realtors List          -->
<!   *********************************   -->


<div id = "calculator">
    <?php

			 include 'Assignment_8_Using_common_functions.php';

			 	displayRealtors();

			 ?>

 </div>


<div id="endpage">
			 	<br /><br /><br /><br />
</div>

 <?php
			 function displayRealtors()
			 {
			 	$statement  = "SELECT lastname, firstname, phone, email, image_file ";
			 	$statement .= "FROM s1583_realtor ";
			 	$statement .= "ORDER BY firstname ";



			 	$sqlResults = selectResults($statement);

			 	$error_or_rows = $sqlResults[0];

			 	if (substr($error_or_rows, 0 , 5) == 'ERROR')
			 	{
			 		print "<br />Error on DB";
			 		print $error_or_rows;
			 	}
			 	else
			 	{

			 		$arraySize = $error_or_rows;

			 		for ($i=1; $i <= $error_or_rows; $i++)
			 		{
			 		    $lastname = $sqlResults[$i]['lastname'];
			 			$firstname = $sqlResults[$i]['firstname'];
			 			$phone = $sqlResults[$i]['phone'];
						$email = $sqlResults[$i]['email'];
			 			$image_file = $sqlResults[$i]['image_file'];

			 			$fullName = "$firstname $lastname";


			 			 print "<p><img src='images/".$image_file."' onMouseOver = showcontact('this','".$lastname."') onmouseout = hidecontact(this)>";
			 			 print "<br />".$firstname."</p>\n";


			 	     }






				}


		}

	     ?>
<div id = "contactdiv">
</div>

<div id="footer">
 <p> <a href = " Assignment_8_GuestBook_Form.php "> View Guestbook </a>  /
      <a href = " Assignment_8_CalculateMortgage.php "> Calculate Mortgage </a>
     </p>

 </div>

</body>
</HTML>

Reply With Quote
  #4  
Old September 11th, 2012, 03:26 PM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,809 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 18 h 6 m 48 sec
Reputation Power: 6112
I've moved your thread to the javascript forum. Get this working without PHP first.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > PHP5 - Need Help for onmouseover in PHP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap