onmouseover question

R

Richard

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.
 
R

Randy Webb

Richard said:
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();
}
 
R

Richard

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.
 
R

Richard

<a href="#" onmouseover="doThis();doThat()">
<a href="#" onmouseover="doBoth()">
function doBoth(){
doThis();
doThat();
}


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])"
 
R

Randy Webb

Richard said:
<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.
 
R

Richard



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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top