in php onmouseout is not working
Moderator: General Moderators
-
pavanesh2009
- Forum Commoner
- Posts: 30
- Joined: Wed Jan 13, 2010 7:24 am
in php onmouseout is not working
Hi All!!
I am using onmouseover functionality in php & my code is here:
echo "<a href='#' onmouseover='gettree_nickname($var)'; onmouseout='setTimeout(gettree_nickname($var),1000);'>lookup a tree</a>";
Though onmouseover works fine,but onmouseout is not working properly.
Is there any syntax mistake, or way of using it is not correct, please suggest.
Thanks in advance!!
I am using onmouseover functionality in php & my code is here:
echo "<a href='#' onmouseover='gettree_nickname($var)'; onmouseout='setTimeout(gettree_nickname($var),1000);'>lookup a tree</a>";
Though onmouseover works fine,but onmouseout is not working properly.
Is there any syntax mistake, or way of using it is not correct, please suggest.
Thanks in advance!!
Re: in php onmouseout is not working
PHP doesn't know what JavaScript is. Problems with one have absolutely nothing to do with the other.
Looking at it, are you sure you have the right code for the mouseout? It's the same stuff as the mouseover.
Looking at it, are you sure you have the right code for the mouseout? It's the same stuff as the mouseover.
-
pavanesh2009
- Forum Commoner
- Posts: 30
- Joined: Wed Jan 13, 2010 7:24 am
Re: in php onmouseout is not working
Thanks tasairis for help!!
but in JavaScript the syntax is
setTimeout("functionName()", 1000); // with quotes
I am just trying to use it, Is there any other procedure to do this..
Thanks once again!!
but in JavaScript the syntax is
setTimeout("functionName()", 1000); // with quotes
I am just trying to use it, Is there any other procedure to do this..
Thanks once again!!
tasairis wrote:PHP doesn't know what JavaScript is. Problems with one have absolutely nothing to do with the other.
Looking at it, are you sure you have the right code for the mouseout? It's the same stuff as the mouseover.
Re: in php onmouseout is not working
You have a semi-colon outside of the quotes -
you need to remove that
Code: Select all
onmouseover='gettree_nickname($var)';Re: in php onmouseout is not working
Try this:
however what in what i'm seeing you are performing the same function for the mouseover and mouseout event. It would be nice if you stated exactly what you wanted with both events.
Code: Select all
echo '<a href="#" [color=#0000FF]onmouseover[/color]="gettree_nickname('.$var.');" [color=#0000FF]onmouseout[/color]="[color=#FF4000]setTimeout[/color](\'gettree_nickname('.$var.')\', 1000);">lookup a tree</a>';-
pavanesh2009
- Forum Commoner
- Posts: 30
- Joined: Wed Jan 13, 2010 7:24 am
Re: in php onmouseout is not working
Thanks for reply realnsleo & pytrin!!
I tried both suggestions but still same problem, let me explain it more clearly, I have menu link called "lookup a tree" once mouse comes over, it display a dropdown which is coming through ajax function, now i want as soon as user removes mouse from that position, dropdown should be disable(hide).I am displaying it inside a <li> tag, here is the code:
<?php
if( $_SESSION['user_id'] )
{
$sql = mysql_query("SELECT user_tree_id FROM user_tree_table WHERE user_id='$_SESSION[user_id]'");
while($row = mysql_fetch_array($sql))
{
$var = $row['user_tree_id'];
}
}
echo "<li>";
echo "<a href='#' onmouseover='gettree_nickname($var)'; onmouseout='setTimeout('gettree_nickname($var)',1000)';>lookup a tree</a>";
echo "<div id='tree_nicknamediv'></div>";
echo"</li>";
?>
Thanks in Advance!!
I tried both suggestions but still same problem, let me explain it more clearly, I have menu link called "lookup a tree" once mouse comes over, it display a dropdown which is coming through ajax function, now i want as soon as user removes mouse from that position, dropdown should be disable(hide).I am displaying it inside a <li> tag, here is the code:
<?php
if( $_SESSION['user_id'] )
{
$sql = mysql_query("SELECT user_tree_id FROM user_tree_table WHERE user_id='$_SESSION[user_id]'");
while($row = mysql_fetch_array($sql))
{
$var = $row['user_tree_id'];
}
}
echo "<li>";
echo "<a href='#' onmouseover='gettree_nickname($var)'; onmouseout='setTimeout('gettree_nickname($var)',1000)';>lookup a tree</a>";
echo "<div id='tree_nicknamediv'></div>";
echo"</li>";
?>
Thanks in Advance!!
realnsleo wrote:Try this:
however what in what i'm seeing you are performing the same function for the mouseover and mouseout event. It would be nice if you stated exactly what you wanted with both events.Code: Select all
echo '<a href="#" [color=#0000FF]onmouseover[/color]="gettree_nickname('.$var.');" [color=#0000FF]onmouseout[/color]="[color=#FF4000]setTimeout[/color](\'gettree_nickname('.$var.')\', 1000);">lookup a tree</a>';
Re: in php onmouseout is not working
Put an alert in your javascript functions to check if they're being called at all, and maybe just aren't working.
-
pavanesh2009
- Forum Commoner
- Posts: 30
- Joined: Wed Jan 13, 2010 7:24 am
Re: in php onmouseout is not working
Thanks jraede!!
Well I checked alert & guess what ...It's working fine but when it comes to setTimeout, It's not working,I just want to call a function for a small time period & then it should go off.
Do I need to write a separate function for hiding this drop down?
Well I checked alert & guess what ...It's working fine but when it comes to setTimeout, It's not working,I just want to call a function for a small time period & then it should go off.
Do I need to write a separate function for hiding this drop down?
jraede wrote:Put an alert in your javascript functions to check if they're being called at all, and maybe just aren't working.
Re: in php onmouseout is not working
Well, if the alert isn't showing up, that means your function has an error (javascript unfortunately does not have error reporting through the browser). You'll need to post the non-working function if you want some help.
(Also, sorry for the delay, I forgot to request e-mail reply notifications so I just noticed this was still unsolved)
(Also, sorry for the delay, I forgot to request e-mail reply notifications so I just noticed this was still unsolved)