[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writing to frames



chandy@lunatech.com wrote:
> 
> Hi all,
> 
> I have a list of links in one frame. On a mouseover() event I want a brief
> description of the currently selected link to be written in another small
> frame in the user window. How can I write to other frames in a window from
> within this frame?
> 
> Please respond direct to my mail address as well, as I receive the list in
> digest form.
> 
> Thanks in advance,
> 
> Chandy
> 

I use the following function to load a new URL into a frame:


function load_URL(sectionPath,sectionRoot) {
		alert ("In Dual load URL")
		alert ("sectionPath="+sectionPath)
		alert ("sectionRoot="+sectionRoot)
		alert ("About to load " + sectionRoot + " in " + 
sectionPath)
		window.MAIN.location.href=HomeURL + sectionPath 
+"MAIN_" + sectionRoot + ".htm"
	}

Ignore the alerts, they are just for debugging.
HomeURL is a global defined outside this function.
The important line is window.MAIN.location.href=...
where MAIN is the name of the frame, as defined when the frame was 
created.

In its simplest form you can just use:
window.FRAMENAME.location.href="http://www.mysite.com/newfile.htm";

Note that this method will load a new URL into the frame, not simply 
pop up some text that is already in the javascript. The advantage to 
this is 1) that you can put a lot of text in the frame, more than 
you would want to send initally, and 2) you can include other 
things, such as pictures, and sound. The disadvantage is that it 
requires going back to the server.

You could store some information in a script to write to the window. 
I think you would want to look at open and close methods for that. 
I've never tried it.

Another thing you could do is write the info to the status bar at 
the bottom of the screen. In fact, this is what I do. All you have 
to do is:
window.status="text to dispay"
You will probably also want to set a timeout so the information 
vanishes after a few second unless the mouse remains over the 
object. I have this code (its very simple) and will send it to you 
if you want it.

Hope it helps
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/