[Javascript] ? Need help on frame ?

David T. Lovering dlovering at gazos.com
Tue Apr 1 08:13:11 CST 2003


This reads like the script from the old Abbott & Costello gag "Who's on First?".

I suspect I'll need both a directory map and a diagram of how your frames are
linked together in order to visualize the exact nature of your problem.  The
way I interpret your remarks is as follows:

  DIRECTORY STRUCTURE:

	.\someDirectory
		index.html
		musicindex.mid (?)
		.\childDirectory
			contentA.html
			frameA.html
			musicA.html

  CODE STRUCTURE:

	index.html  	--> <A HREF=".\childDirectory\frameA.html>myLinkA</A>
			    	--> <OBJECT name='musicindex' id='musicindex' data='musicindex.mid' ...
						 <PARAM name='paramA' ...

    frameA.html 	--> <FRAMESET rows="50%,50%">
						 <FRAME SRC="contentA.html">
                     	 <FRAME SRC="musicA.html">
                    	</FRAMESET>

	contentA.html 	--> <button name='top' onClick='location.href="index.html"' value='top'> (???)

    I'm a little unclear as to what the button 'top' in contentA.html actually does: "goes back to
 	index.html" is a little vague (and creates an endless-mirrors situation).  Does it simply force
	a reload of index.html?  Does it try to load index.html into the frame in which contentA.html
  	formerly resided?  Anything is possible, and only a fraction of it will work.

    Get back to me with some code snippets, etc., and try to elaborate some more on the gory bits.
    In general, any object in a multiframe environment can access any other object in a multiframe
	environment by some variation of the following:

		var myObjectInFrameB = document.frames["frameB"].document.objectName

	If the object(s) are inside a form within the frame, it is slightly more complicated:

							   document.frames["frameB"].document.forms["theForm"].objectName

	... and then of course, you can tweak the attributes of the object using the appropriate ".extension"
	format.

	In general, if you are within the HTML code within one of the child frames and you want to access code
	in another child frame, you need to dereference to the "parent" frame (which actually is a frameset,
	but who's counting)...
								parent.frames["frameB"].document.forms["theForm"].objectName

	A shorthand notation for this is

								parent.frameB.document.forms["theForm"].objectName

	I think you want to mess with the selection of the midi File in the original index.html file (outside
	the frames heirarchy), which would be done via window.opener, using the model shown above:

								window.opener.document.getElementById("musicindex").data = 'myMusic.mid'

	... or something very similar, depending on how imprecise my imaginings are.

  -- Dave Lovering
		

light_wt wrote:
> 
> Hi,
> 
> I have more or less a redirect problem using frame in html code.  I wonder
> if there is a clean solution using javascript.
> 
> In html, I have these files:
> index.html (with background musicindex.mid),
> frameA.html,
> musicA.html, and
> contentA.html.
> 
> >From a link in index.html, it will launch frameA.html with musicA.html and
> contentA.html.
> 
> Inside of the contentA.html, there are the previous, top, and next buttons.
> As the musicA.html is playing along, clicking  the top button goes back to
> the index.html using <A href="../index.htm" >.
> 
> The problem is when displaying index.html.  The index.html is being display
> as part of the frame from frameA.html.  Therefore, it is still playing the
> musicA.html from the frameA, rather than playing the musicindex.mid.
> 
> What should I do to make the top button link in contentA.html to play the
> background muisic of  index.html?
> 
> Thanks.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript


More information about the Javascript mailing list