Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Param undefined for onmouseover function! Help

Reply
Thread Tools

Param undefined for onmouseover function! Help

 
 
james
Guest
Posts: n/a
 
      10-01-2006
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

 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      10-01-2006
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML::Template->param() : You gave me an odd number of parameters to param()! Dave Perl Misc 5 04-26-2011 02:44 AM
Undefined subroutine &main::param called paul.hopgood@deathnotify.com Perl Misc 2 02-18-2009 08:35 AM
Overload by deriv class param; call w base class param ectoplasm C++ 12 07-28-2005 08:20 AM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM
XSLT: How to replace param name with this param's value ? Geathaa XML 2 07-30-2003 06:48 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57