Click to See Complete Forum and Search --> : referencing variable in one frame from another


Alan Klein
09-29-2003, 11:55 AM
Hello,
Hopefully this is an easy question with a simple answer. I have a frameset with a top, right, bottom, and left frame all surrounding a "main" frame in the middle. What I would like to do is keep a counter variable on one of the outside frames so that in the "onLoad" event of the main frame I can check that counter and depending on its value load one .htm file or another. But I'm not sure how to reference a variable in another frame from the "main" frame (or how to increment it once I've got it).

If this is not doable, is there a way I can pass a parameter into the frameset when I call it and then use that parameter to determine which .htm file to load?

Thanks!

Khalid Ali
09-29-2003, 12:02 PM
declare a javascript variable in the page that has all the framset code then you can access that variable from any of the children frames

parent.variableName

to access a variable decalred in a frame

parent.frameName.variableName

Alan Klein
09-29-2003, 12:12 PM
thanks Khalid. What you said works, but I guess I didn't explain my problem properly. What I'm doing is when they click on a button on the top frame I am loading an .htm file into the 'main' frame'. On that .htm file is an "OK" button and when they click that I want to load another file into the 'main' frame. But the problem is that the first .htm file is not part of the frameset. So what I was doing was just reloading the frameset. The variable I declare in the frameset gets reset every time it gets loaded I guess, so I can't increment it. Is there a way to pass a parameter to the frameset when I load it?

jellybean19
10-01-2003, 06:24 AM
i hav a big problem with my site! i created my site in dreamweaver at a screan res of 800*600 but when i take my site onto a computer with a different res then my banner shortens(its set as a background image, noresize) and my background image for my main frame tiles(which is a logo with a grey background). how do i stop this from happening?:confused:

David Harrison
10-01-2003, 07:28 AM
In any element that you have a background image that you don't want to tile, (eg. <body> or <table>), add this:

<body style="background-image:url('123.gif');background-repeat:no-repeat;">

jellybean19
10-02-2003, 04:04 AM
lavalamp! please can i email my page to you and you can look at my coding and tell me whats wrong with it so that it will stop doing this?

David Harrison
10-02-2003, 05:55 PM
Yeah, you can feel free to e-mail me, but make sure that it has got lavalamp somewhere in the subject, otherwise I'll just delete it as junkmail.

If the web-site is online though you could just post a URL, and if it isn't online then you could just zip it and add it to a post as an attachment.