PDA

View Full Version : Need help opening DHTML Window widget into other frame



Joefunkx
06-07-2007, 02:02 PM
1) Script Title: DHTML Window widget (v1.03)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem: Trying to launch window from one frame to appear in another

My site is designed in the following manner-

index.html has frames which point to top.html and main.html
thus on loading, the browser displays the following--

------------------
| top window
|----------------
|
| main window
|
|______________

when i reference the windows from one another with an <A> statement, I use target="main" for the main page. My problem is, the link that I want to use to launch the DHTML window is in the TOP WINDOW, but it uses an ONCLICK to launch so i cannot get it to launch the window inside the MAIN window. Does anyone know a way to accomplish this? Thanks for the help!

ddadmin
06-07-2007, 02:39 PM
Instead of something like:


<a href="#" onClick="yahoowin=dhtmlwindow.open('yahoo', 'iframe', 'http://yahoo.com', 'Yahoo', 'width=500px,height=300px,center=1'); return false">Show Yahoo</a>

Try:


<a href="#" onClick="yahoowin=parent.mainwin.dhtmlwindow.open('yahoo', 'iframe', 'http://yahoo.com', 'Yahoo', 'width=500px,height=300px,center=1'); return false">Show Yahoo</a>

Make sure all the DHTML window files are installed inside the Main Window page (not the top frame). All the above code does is try and call the dhtmlwindow() function that is inside the main window (versus the current frame, or top window). I haven't tested this yet, though it should work.

Joefunkx
06-07-2007, 02:53 PM
by MAIN WINDOW PAGE, do you mean the INDEX.HTML file that contains the FRAMESETS or the MAIN.HTML that i want the window to pop up in?

ddadmin
06-07-2007, 02:58 PM
Main window page as in the page that is contained inside the "Main" frame. For example:


<html>
<frameset rows="50&#37;,50%">
<frame name="topwin" src="page1.htm">
<frame name="mainwin" src="page2.htm">
</frameset>
</html>

So I'm referring to "page2.htm", which is btw accessed via the "mainwin" name assigned to its frame.

Joefunkx
06-07-2007, 03:05 PM
OK, I tried the following..

I put this link into the TOP.HTML (name=top)

<a href="#" onClick="divwin=parent.main.dhtmlwindow.open('divbox', 'div','somediv', '#4: DIV Window Title', 'width=450px,height=300px,left=200px,top=150px,resize=1,scrolling=1'); return false" target=main></a>



i put the following two lines into the MAIN.HTML (name=main) but NOT in the TOP.HTML

<link rel="stylesheet" href="dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="dhtmlwindow.js"></script>



I put the <DIV> being used in the MAIN.HTML file

<div id="somediv" style="display:none">
<p style="height: 400px">This is some content within a DIV, shown inside this window instead</p>
</div>

however, all I get is the TOP.HTML file being opened into the main window, no DHTML window popping up at all. If i take out the target="main" from the <A>, i don't get anything.

ddadmin
06-07-2007, 04:06 PM
Two questions:

1) Is your "main window" frame named "main"? For example:


<html>
<frameset rows="50&#37;,50%">
<frame name="topwin" src="page1.htm">
<frame name="main" src="page2.htm">
</frameset>
</html>

2) Inside "main.html", did you include the entire DHTML window widget script and file references in its HTML?

Joefunkx
06-07-2007, 04:33 PM
yes, the frame "main" is MAIN.HTML.

The only code that I put in the MAIN.HTML file was the following -

<link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />

<script type="text/javascript" src="windowfiles/dhtmlwindow.js">



I've tested the code by just putting those lines into the TOP.HTML file along with the link and it worked ok that way.

ddadmin
06-08-2007, 05:53 PM
Do you happen to have the test pages online? It would definitely make it easier for me to see where the problem is that way...

Joefunkx
06-14-2007, 07:37 PM
Thanks for your help ddadmin, I figured out the problem.