Easy Javscript ??? Combining two functions....

jonnyGURU

Moderator <BR> Power Supplies
Moderator
Oct 30, 1999
11,815
104
106
I've got two functions. First one loads and iFrame with content, the second is a simple image swap:


function over(imgname,imgsrc) {
document[imgname].src=imgsrc;
}

function loadIframe(iframeName, url) {
if ( window.frames[iframeName] ) {
window.frames[iframeName].location = url;
return false;
}


I want to pull off both functions with the same OnMouseOver event. Only works in NS though. Not IE. Something wrong with my syntax?


function MO1()
{
over('4600','2420mouseon.gif');
loadIframe('ifrm', 'Avaya2420.htm');
}


The link looks like this:


<a href="Avaya4600.htm" target="ifrm" onMouseOver="MO1();" onMouseOut="out('4600','images/2420mouseoff.gif');" >
<img src="images/2420mouseoff.gif" border=0 name="4600" width=600 height=30></a>


If I replace the "MO1()" with "over('4600','2420mouseon.gif')" or with "loadIframe('ifrm', 'Avaya2420.htm')" they both work in both browsers. I only have a problem running both together.
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
1. Your function loadIframe is missing a closing curly brace }
2. I think you can call both functions in your HTML <a>nchor tag:

<a href="Avaya4600.htm" target="ifrm" onMouseOver="over('4600','2420mouseon.gif'); loadIframe('ifrm', 'Avaya2420.htm');" onMouseOut="out('4600','images/2420mouseoff.gif');" >
<img src="images/2420mouseoff.gif" border=0 name="4600" width=600 height=30></a>

Otherwise, i'm not sure about it, since i'm not all that good with javascript.... -(