Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling a function in another frame

Status
Not open for further replies.

innmedia

Programmer
Mar 24, 2000
108
US
Hi,

I have a web page with frames. In one frame I have a graphic wrapped in <A HREF...> so it acts like a link.

When clicked I want to run a javascript in a different frame. The target frame has this script (an easy one for now which I will replace with something useful later)...

<Script Language=&quot;Javascript&quot;>
function zz(that)
{
window.alert(&quot;hi&quot;);
}
</Script>

How do I complete the tag in the first frame. So far I have...

<A HREF=&quot;csstest.html&quot; target=&quot;Main&quot;><Img src=&quot;click1.gif&quot;></a>

This doesn't get the script to run. What do I have to add to the tag?

Thanks,

Ken B
 
If you had named your frames, 'bill' and 'ben', where bill contains the script and ben contains the clickable link the link would be as follows:

<A HREF=&quot;javascript:top.bill.zz('blah')&quot;><Img src=&quot;click1.gif&quot;></a>

Note that you don't need the target, as the top.bill bit refers to the correct frame. From you example I suspect the correct code would be:

<A HREF=&quot;javascript:top.Main.zz('blah')&quot;><Img src=&quot;click1.gif&quot;></a>


Barbie
Leader of Birmingham Perl Mongers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top