Forum Moderators: open

Message Too Old, No Replies

More Than 1 Onclick Function?

         

Magpie

10:19 am on Apr 12, 2004 (gmt 0)

10+ Year Member



Hi there!

On my website i have this bit of code that when you click on a link it changes something in and out of my Iframe

<a target="I1" href="latestnews.htm"onclick="document.getElementById('one').src='images/Eyes%202.jpg';
document.getElementById('two').innerHTML=
'<font face=Verdana size=1 color=#FF0000><b>Latest News<b/></font>' ">
<img border="0" src="images/News.gif" width="41" height="8"></a><font color="#FFFFFF">

------------------------------------------------------

I would like to add this bit of code aswell:

OnMouseover="window.status='Under Judgement';return true;";" OnClick="window.status='Under Judgement';return true;";"

------------------------------------------------------

I managed to get it to work... BUT! it cancels out my previous code. Is there any way I can incorperate that code to make it work aswell as the other one

All help is appreciated

Kind Regards

Martin

Alternative Future

10:35 am on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Magpie,

Would this sort of function call work?

<script language=javascript>
function myDoubleFunction(){
document.getElementById('one').src='images/Eyes%202.jpg';
document.getElementById('two').innerHTML= '<font face=Verdana size=1 color=#FF0000><b>Latest News<b/></font>'
window.status='Under Judgement'
}
</script>

Then from your link:

OnMouseover="window.status='Under Judgement';return true;";" OnClick="myDoubleFunction();return true;"

-George

Magpie

11:06 am on Apr 12, 2004 (gmt 0)

10+ Year Member



Yea it worked cheers!... BUT! I have more than 1 link I want to do this function... Is there an easier way than making a call code for each link?

Cheers

Martin

Alternative Future

11:37 am on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can pass in variables like so:

<script language=javascript>
function myDoubleFunction(variable1, variable2){
document.getElementById(variable1).src='images/Eyes%202.jpg';
document.getElementById(variable2).innerHTML= '<font face=Verdana size=1 color=#FF0000><b>Latest News<b/></font>'
window.status='Under Judgement'
}
</script>

OnMouseover="window.status='Under Judgement';return true;";" OnClick="myDoubleFunction(one, two);return true;"

See if that works for you.

-George