By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,993 Members | 1,984 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,993 IT Pros & Developers. It's quick & easy.

onmouseover question

P: n/a
I know I can have like <a href="#" onclick="dothis" onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">

As an example of use:
Column A holds menu items.
When a mouse over is performed, two actions take place instead of one.
Action one sends an image to a division in column B, action two sends text
to another division in column B.

What's the trick?

I am searching google for the answer as well.
Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Richard wrote:
I know I can have like <a href="#" onclick="dothis" onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">


<a href="#" onmouseover="doThis();doThat()">
OR:
<a href="#" onmouseover="doBoth()">

function doBoth(){
doThis();
doThat();
}

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2

P: n/a
On Fri, 7 Jan 2005 20:57:11 -0600 Richard wrote:
I know I can have like <a href="#" onclick="dothis"
onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat"> As an example of use:
Column A holds menu items.
When a mouse over is performed, two actions take place instead of one.
Action one sends an image to a division in column B, action two sends
text
to another division in column B. What's the trick? I am searching google for the answer as well.


Ok. Sort of found the solution I guess. Simple enough.

onmouseover="dothis" ; "do that"
Now all I need to do is to figure out how to place the two actions in the
proper divisions.
Jul 23 '05 #3

P: n/a
Richard wrote:
[...]
onmouseover="dothis" ; "do that"


Bzzzzt. "do that" will not be called.

As Randy posted:

onmouseover="dothis(); dothat()"

--
Rob
Jul 23 '05 #4

P: n/a
On Fri, 07 Jan 2005 22:31:17 -0500 Randy Webb wrote:
Richard wrote:
I know I can have like <a href="#" onclick="dothis"
onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">
<a href="#" onmouseover="doThis();doThat()"> <a href="#" onmouseover="doBoth()"> function doBoth(){
doThis();
doThat();
}


Thanks Randy.
I figured it was purely in the syntax thing.

Jul 23 '05 #5

P: n/a
On Fri, 07 Jan 2005 22:31:17 -0500 Randy Webb wrote:
Richard wrote:
I know I can have like <a href="#" onclick="dothis"
onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">
<a href="#" onmouseover="doThis();doThat()"> <a href="#" onmouseover="doBoth()"> function doBoth(){
doThis();
doThat();
} --
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq

Would this work then?

onmouseover="changetext(content[1]);changetext(content[2])"

But what I aiming at doing is, having the content in two seperate divisions
change at the same time.
So perhaps I could have:
onmouseover="changetext(content[1]);changeimage(content[2])"

Jul 23 '05 #6

P: n/a
Richard wrote:
On Fri, 07 Jan 2005 22:31:17 -0500 Randy Webb wrote:

Richard wrote:
I know I can have like <a href="#" onclick="dothis"
onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">

<a href="#" onmouseover="doThis();doThat()">


<a href="#" onmouseover="doBoth()">


function doBoth(){
doThis();
doThat();
}



Would this work then?

onmouseover="changetext(content[1]);changetext(content[2])"


Test it and see :-)

But what I aiming at doing is, having the content in two seperate divisions
change at the same time.
So perhaps I could have:
onmouseover="changetext(content[1]);changeimage(content[2])"


Lets say you have a div tag with id="myDiv" and an image with
name="myImage". If you want to change it, then you pass a single
parameter to a single function that then changes it all.

var content = new Array()
content[0] = ['...','...'];
content[1] = ['...','...'];
content[2] = ['...','...'];
content[3] = ['...','...'];

function changeIt(param({
document.getElementById('myDiv').innerHTML = content[param][0];
document.images['myImage'].src = content[param][1];
}

<a href="#" onmouseover="changeIt(1)" onmouseout="changeIt(0)
onclick="return false">Change it to 1</a>
<a href="#" onmouseover="changeIt(2)" onmouseout="changeIt(0)
onclick="return false">Change it to 2</a>
<a href="#" onmouseover="changeIt(3)" onmouseout="changeIt(0)
onclick="return false">Change it to 3</a>

And so on.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7

P: n/a
On Sat, 08 Jan 2005 02:27:15 -0500 Randy Webb wrote:
Richard wrote:
On Fri, 07 Jan 2005 22:31:17 -0500 Randy Webb wrote:
Richard wrote: I know I can have like <a href="#" onclick="dothis"
onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">
<a href="#" onmouseover="doThis();doThat()">
<a href="#" onmouseover="doBoth()">
function doBoth(){
doThis();
doThat();
}

Would this work then? onmouseover="changetext(content[1]);changetext(content[2])"
Test it and see :-)
But what I aiming at doing is, having the content in two seperate
divisions
change at the same time.
So perhaps I could have:
onmouseover="changetext(content[1]);changeimage(content[2])"

Lets say you have a div tag with id="myDiv" and an image with
name="myImage". If you want to change it, then you pass a single
parameter to a single function that then changes it all. var content = new Array()
content[0] = ['...','...'];
content[1] = ['...','...'];
content[2] = ['...','...'];
content[3] = ['...','...']; function changeIt(param({
document.getElementById('myDiv').innerHTML = content[param][0];
document.images['myImage'].src = content[param][1];
} <a href="#" onmouseover="changeIt(1)" onmouseout="changeIt(0)
onclick="return false">Change it to 1</a>
<a href="#" onmouseover="changeIt(2)" onmouseout="changeIt(0)
onclick="return false">Change it to 2</a>
<a href="#" onmouseover="changeIt(3)" onmouseout="changeIt(0)
onclick="return false">Change it to 3</a> And so on.


Thanks Randy. I'll figure it out eventually.

Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.