IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes Frame Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Frame Problem" Watch "Frame Problem" New topic
Author

Frame Problem

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 763
Hi All,
Heres what I'm doing: I have a Perl script that creates HTML/javascript pages. This script is located in one frame. In the loading of one of the pages that goes through Perl, I want to change the frame source of another frame. I have a function that does this (heres the code) :
window.parent.frames[1].src = "/tempdirectory/filename.txt";

When I run this application the function gets hit fine but the second frame doesnt show anything. Is there some sort of refresh that I need to apply? Basically I have a blank.htm file that resides in the frame until this piece of code gets hit that will replace it. The first frame with the application is set to 100% and the second frame is set to *. I've set it up this way because I want to print to a printer directly (mimic it anyway) and so I have the HTML page in the second screen with the <OBJECT> tag being used along with using the ExecWB method. If anyone can see what I'm doing wrong or have left out I's greatly appreciate any response(s). Thanks.
Rob
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 763
Hey,
Forget that part of the question, figured it out. I was wondering though if I have to access a frame from another frame can I somehow use the insertAdjacentText method to insert into the associated document? I have this code :
window.parent.frames['display']
... but I want to add something like this :
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

upper_object = window.parent.frames['display'];
upper_object.body.insertAdjacentHTML('beforeend', WebBrowser);
Is there a solution to this? If so I'd appreciate any help.
Rob
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
with javascript
you can document write stuff to a frame
FRAMESTUFFID.document.write(TextStr)
and make the TextStr the code you want
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 763
Eric,
Thanks for the reply. I have found the solution online afterwards. If you would like you can close this posting altogether. I've posted a new one with just the solution I found to print "directly" to a printer without the print dialog box or using just the currently displayed HTML page. Since that one covers the whole issue this one can be deleted and that one could be closed for future reference. Thanks a lot.
Rob
 
 
subject: Frame Problem
 
Threads others viewed
Frames loading twice on refresh
Sequence of Events
Automatic Printing
Cookies
Problem refreshing page
developer file tools