www.webdeveloper.com
Results 1 to 8 of 8

Thread: Adding mouseover

  1. #1
    Join Date
    May 2014
    Location
    UK
    Posts
    4

    Adding mouseover

    Hi all
    I am looking for some help with a script I already have that works fine BUT I want it to also show a mouse over (table=Objects column=Description) when people hover over the image. Any help would be appreciated, I have no clue

    PHP Code:
    function OBJECT_DisplayObject($P_Element)
    {
    $T_List explode(",",$P_Element);
    $T_Name $P_Element;
    $T_FullName OBJECT_GiveDevelopedNameOfObject($P_Element);
    echo 
    "<div style=\"width:160px;height:160;font-family:Garamond;\">"
               
    "<img src=\"ressources/images/objects/"
               
    .  $P_Element
               
    ".jpg\" width=150 height=150 hspace=0 vspace=0>"
               
    "</div>";
    echo 
    "<div style=\"width:160px;height:40;font-family:Garamond;\"><center><b>"
               
    .  $T_Name
               
    "</b>";
    if (
    $T_Name != $T_FullName)
      {
      echo 
    "<br>" .  $T_FullName;
      }
    echo 
    "</div>";

    Last edited by NogDog; 05-22-2014 at 09:48 PM. Reason: added [php] tags around code

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,637
    Just add a title attribute to the img tags in question, unless I'm missing something?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    May 2014
    Location
    UK
    Posts
    4
    As the image code is spread across several lines I am not sure where to place it, everything I have tried results in nothing.

  4. #4
    It's not clear what you want to happen on mouseover... Just what are you asking for it to do? Show another image? Show some text?

    Done properly, it sounds like you need to add another tag and then a :hover state to it's parent in the CSS. Yes, CSS... as this isn't something PHP or JS have any business doing (other than generating the markup to be manipulated)

    Question: how old is that code? vspace and hspace have had no business on any website written after 1997, and even then nobody ever really used them... Likewise the style attribute in the PHP shows developer ineptitude on the skinning/theme; as does the double quotes followed by escaped double quotes, use of string addition and multiple strings for no good reason, and host of other telltales that honestly, would probably make me pitch whatever it is you are working on in the trash an start over from scratch.

    Like that whole multiple name manipulating nonsense -- without seeing a sample of what's being passed to that function, and what that "OBJECT_GiveDevelopedNameOfObject" function is doing, it would be very hard to weigh in meaningfully, though I have the sneaking suspicion that:

    Code:
    function OBJECT_DisplayObject($P_Element) {
    $T_FullName = OBJECT_GiveDevelopedNameOfObject($P_Element);
    
    echo '
    	<div class="imageObject">
    		<img
    			src="ressources/images/objects/', $P_Element, '.jpg"
    			width="150" height="150"
    		/>
    		<div>', $T_FullName, '</div>
    	</div>';
    }
    Is all that should be there... at least if you have any idea how HTML and CSS works.

    I also have to ask -- just where would this "(table=Objects column=Description)" data you want to be showing even be coming from?

  5. #5
    Join Date
    May 2014
    Location
    UK
    Posts
    4
    It is to pull information from a mysql database. The description of an object. So when you hover over the object image it shows the description of the object.

  6. #6
    Join Date
    May 2014
    Posts
    10
    Add title attribute on image tag like this:
    <img src="" title="add title here" />

  7. #7
    I'd have to see the code or at bare minimum the data being passed by the code -- you're just giving vague descriptions that don't tell any of us anything.

  8. #8
    Join Date
    May 2014
    Location
    UK
    Posts
    4
    Thank you very much for your guidance koyal. That was exactly what I came here looking for. Still had some work to do but got it working.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles