Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Support > Re: Calling 2 functions from JavaScript OnMouseOver

Reply
Thread Tools

Re: Calling 2 functions from JavaScript OnMouseOver

 
 
VanguardLH
Guest
Posts: n/a
 
      12-31-2010
~~Rob Telp~~ wrote:

> Is it possible to call 2 functions in the OnMouseOver event itself?
>
> Currently I am doing: <a onMouseOver="FUNCTION1()"</a>
>
> I would like to call 2 functions if possible: <a onMouseOver="FUNCTION1()
> FUNCTION2()"</a>
>
> If it is possible, what is the syntax and what do I use to separate the 2
> functions? I have tried a space, comma, semi colon and colon and none
> appear to work.
>
> TIA


I haven't tested this but I thought the Javascript you specified in the
string for the event could be like code lines that you write. In other
words, separate the lines with the semicolon character as you would when
writing the Javascript alone. Does the following work?

<a onmouseover="func1();func2()" ...</a>

If I'm wrong and that doesn't work, why not have a wrapper function that
calls the other two.

<a onmouseover="funcmult()"...</a>

where funcmult calls func1 and func2. Another possibility is where you
have the onmouseover function for an element defined separately from it,
as in:

<a ... id="a1">
<script type="text/javascript">
document.getElementById('a1').onmouseover = function(){
func1();
func2();
<any other code>
}
</script>

You define separately the function for the onmouseover event for the
element that you specify by its id tag. That is, you tag the element
with an id that can be used later to identify that particular element.
Then you define its onmouseover property with the [wrapper] function
that you want to use.

I'm no Javascript programmer (just have had occasion to get my nose
pushed into it a few times). A better place to ask would be in a
Javascript programming group, like:

comp.lang.javascript
(or any of the *.javascript newsgroups)
 
Reply With Quote
 
 
 
 
MyNews
Guest
Posts: n/a
 
      12-31-2010
Mr. VanguardLH

I believe wrapper function is the one he looking for!

"VanguardLH" <> wrote in message
news:ifk3hg$qsm$...
> ~~Rob Telp~~ wrote:
>
>> Is it possible to call 2 functions in the OnMouseOver event itself?
>>
>> Currently I am doing: <a onMouseOver="FUNCTION1()"</a>
>>
>> I would like to call 2 functions if possible: <a
>> onMouseOver="FUNCTION1()
>> FUNCTION2()"</a>
>>
>> If it is possible, what is the syntax and what do I use to separate the 2
>> functions? I have tried a space, comma, semi colon and colon and none
>> appear to work.
>>
>> TIA

>
> I haven't tested this but I thought the Javascript you specified in the
> string for the event could be like code lines that you write. In other
> words, separate the lines with the semicolon character as you would when
> writing the Javascript alone. Does the following work?
>
> <a onmouseover="func1();func2()" ...</a>
>
> If I'm wrong and that doesn't work, why not have a wrapper function that
> calls the other two.
>
> <a onmouseover="funcmult()"...</a>
>
> where funcmult calls func1 and func2. Another possibility is where you
> have the onmouseover function for an element defined separately from it,
> as in:
>
> <a ... id="a1">
> <script type="text/javascript">
> document.getElementById('a1').onmouseover = function(){
> func1();
> func2();
> <any other code>
> }
> </script>
>
> You define separately the function for the onmouseover event for the
> element that you specify by its id tag. That is, you tag the element
> with an id that can be used later to identify that particular element.
> Then you define its onmouseover property with the [wrapper] function
> that you want to use.
>
> I'm no Javascript programmer (just have had occasion to get my nose
> pushed into it a few times). A better place to ask would be in a
> Javascript programming group, like:
>
> comp.lang.javascript
> (or any of the *.javascript newsgroups)


--
http://mynews.ath.cx

 
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
Re: Calling 2 functions from JavaScript OnMouseOver §ñühw¤£f Computer Support 5 12-31-2010 09:27 PM
Re: Calling 2 functions from JavaScript OnMouseOver richard Computer Support 1 12-31-2010 06:20 AM
Re: Calling 2 functions from JavaScript OnMouseOver MyNews Computer Support 0 12-31-2010 04:09 AM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM
External inline functions calling internal inline functions Daniel Vallstrom C Programming 2 11-21-2003 01:57 PM



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