I figured what I was doing wrong.
In foo() I was referencing the global data as e.g
browserversion.
But what I should have done was
window.parent.frames["leftframe"].browserversion.
This way works when you call foo from either frame and not just the one its
defined in.
Thanks for your help.
Tony.
Cathal Garvey wrote:
> this works for me and might give you an indication where you are going
> wrong. If not show us the code
> .cg
>> <html>
> <head>
> <title>Test Frames</title>
> </head>
> <frameset cols="*, *">
> <frame name="left" src="left.html">
> <frame name="right" src="right.html">
> </frameset>
> </html>
>> <html>
> <head>
> <title>Right Frame</title>
> </head>
> <body>
> <a href="javascript:top.frames['left'].foo();">Click Me!</a>
> </body>
> </html>
>> <html>
> <head>
> <title>Left Frame</title>
> <script language="javascript">
> function foo () {
> alert ("Fucntion called and browser is " +
> top.navigator.navigator.appVersion);
> }
> </script>
> </head>
> <body>
>> > -----Original Message-----
> > From: webdev-admin at linux.ie [mailto:webdev-admin at linux.ie]On Behalf Of
> > Tony Clarke
> > Sent: 23 June 2000 11:43
> > To: webdev at linux.ie> > Subject: [Webdev] JavaScript variable scope
> >
> >
> >
> > I'm abit baffled by the scoping rules in Javascript. Imagine the
> > following scenario
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!