473,396 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Param undefined for onmouseover function! Help

OK, I have the following javascript functions:

var TimerID = null;

function onMouseOverHandler(oPopup) {
if (TimerID) {
clearTimeout(TimerID);
}
TimerID = setTimeout(" + oPopup + ", 1500);
}

function onMouseOutHandler() {
if (TimerID) {
clearTimeout(TimerID);
}
// set visibility to hidden
}

I then set the calls up for the function as (server side c# code):

....
{
sPopup = "showtrail('" + sPicPath2 + "','" +
oPic.Title + "','" + oPic.ScreenName + "','" + oPic.TotalComments +
"','" + oPic.Votes + "', '" + oPic.CategoryName + "','1',240,1)";
}
else
{
sPopup = "showtrail('" + sNotFound + "','***
PREVIEW NOT AVAILABLE ***','" + oPic.ScreenName + "','" +
oPic.TotalComments + "','" + oPic.Votes + "', '" + oPic.CategoryName +
"','1',240,1)";
}
string sClose = "hidetrail()";

oImage2.Attributes["onmouseover"] =
"onMouseOverHandler(" + sPopup + ")";
oImage2.Attributes["onmouseout"] =
"onMouseOutHandler(" + sClose + ")";
....

when the onmouseover event fires and calls the onMouseOverHandler, the
oPopup param shows as undefined. What am I missing?

Any help appreciated!

thanks

Oct 1 '06 #1
1 2209
james wrote:
OK, I have the following javascript functions:

var TimerID = null;

function onMouseOverHandler(oPopup) {
if (TimerID) {
clearTimeout(TimerID);
}
TimerID = setTimeout(" + oPopup + ", 1500);
}
<snip>
{
sPopup = "showtrail('" + sNotFound + "','***
PREVIEW NOT AVAILABLE ***','" + oPic.ScreenName + "','" +
oPic.TotalComments + "','" + oPic.Votes + "', '" +
oPic.CategoryName + "','1',240,1)";
}
string sClose = "hidetrail()";

oImage2.Attributes["onmouseover"] =
"onMouseOverHandler(" + sPopup + ")";
oImage2.Attributes["onmouseout"] =
"onMouseOutHandler(" + sClose + ")";
...

when the onmouseover event fires and calls the onMouseOverHandler,
the oPopup param shows as undefined. What am I missing?
<snip>

When you are debugging client-side code it is rarely helpful to be
looking at the server-side code and trying to deduce what it will be
outputting. Instead it is mush more efficient to use the view-source
facility of the browser and look at the code that gets to he browser.
That code is much more likely to expose whatever it is that cases the
problem.

Here the - sPopup - string appears to be the source code for a function
call. That call is then inserted into the argument for the source code
for the - onmouseOverHandler - function call. The result is along the
lines of:-

onmouseover="onMouseOverHandler(
showtrail(' ... ', ' .... ', ' ... ', ' etc. ')
)"

- thus the argument to - onmouseOverHandler - is the return value from
the - showtrail - function, which is presumably the default - undefined -
value.

Richard.
Oct 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark Anderson | last post by:
This is driving me crazy - I'm following through some basic rollover code (below with all extra content stuff stripped away. When I mouseover the image, IE errors, reporting "imagesHilite is...
3
by: jimmygoogle | last post by:
I posted earlier with a scope problem. I think I resolved it in IE but in Firefox it still exists. Anyone have any ideas/experience with this? I attached my code sorry it is so long. You can...
3
by: drjackk | last post by:
Hello, I'm trying to change the onmouseover event dynamically. This sets-up the initial onmouseover event: <a href="home.html"> <img border="0" id="img22" src="images/home1.jpg"...
7
by: dd | last post by:
Hello all. First, I'm a newbie to javascript but not to ASP. Secondly I've been searching for the answer for two hours and I decided to finally post this question. I'm trying to take a...
2
by: Justin Rowe | last post by:
I'm attempting to design a site with alot of dynamic content and intractability, however I've hit a snag when it comes to the function of the onMouseOver and onMouseOut events. Using a bit of code...
1
by: den2005 | last post by:
Hi everybody, I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance. Code working: <form id="form1"...
7
by: kforski | last post by:
Hello I wonder how can I find out if the param given to the xsl is defined without error during compilation. Actually I have such code (a part of it) <xsl:if test="$showWarnings='true']">...
3
by: oopaevah | last post by:
I have written some dom code to create a list of divs, each with it's own id. I want to set the onmouseover and onmouseout events to highlight the div when the mouse is over it. However I cannot...
2
by: Daz | last post by:
Hi everyone. I think my problem is a simple one, but I am completely baffled as to how to pull it off. I have a piece of code like so... document.write( "<img id=\"slideshow_toggle\"...
3
by: Laser Lips | last post by:
HI All, Is it possible to do the following? object = document.getelementById('something'); object.onmouseover='alert("hi");'; ...................
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.