/    Sign up×
Community /Pin to ProfileBookmark

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 ?

[code=php]
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>”;
}
[/code]

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 23.2014 — Just add a [B]title[/B] attribute to the [B]img[/B] tags in question, unless I'm missing something?
Copy linkTweet thisAlerts:
@talmikauthorMay 23.2014 — As the image code is spread across several lines I am not sure where to place it, everything I have tried results in nothing.
Copy linkTweet thisAlerts:
@deathshadowMay 23.2014 — 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:

function OBJECT_DisplayObject($P_Element) {
$T_FullName = OBJECT_GiveDevelopedNameOfObject($P_Element);

echo '
&lt;div class="imageObject"&gt;
&lt;img
src="ressources/images/objects/', $P_Element, '.jpg"
width="150" height="150"
/&gt;
&lt;div&gt;', $T_FullName, '&lt;/div&gt;
&lt;/div&gt;';
}


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?
Copy linkTweet thisAlerts:
@talmikauthorMay 23.2014 — 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.
Copy linkTweet thisAlerts:
@koyalMay 23.2014 — Add title attribute on image tag like this:

<img src="" title="add title here" />
Copy linkTweet thisAlerts:
@deathshadowMay 23.2014 — 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.
Copy linkTweet thisAlerts:
@talmikauthorMay 23.2014 — 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.
×

Success!

Help @talmik spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...