PDA

View Full Version : Link between DHTML windows and DIVs or IFRAMEs



joeltonnberg
08-23-2007, 12:52 AM
1) Script Title: DHTML window widget (v 1.03)

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

3) Describe problem:

Is it any way to target and div or an Iframe on the base page from within one of the windows. I tried:


<a href='javascript:parent.IframeOnBasePage.load("iframe", "MyPage.php", "New Page Title")'>Load a Page</a>

However, that did not work.

ddadmin
08-23-2007, 07:39 AM
I'm confused, are you trying to populate a regular iframe on the page with something from a link within one of the DHTML windows, or a IFRAME DHTML window? The two are very different...

joeltonnberg
08-23-2007, 09:53 AM
sorry for the confusion. I try to populate a regular Iframe from within a DHTML window...

ddadmin
08-24-2007, 12:51 AM
If it's just a regular iframe, first, give it an name attribute:


<iframe name="myframe" src="http://google.com"></iframe>

Then, inside your DHTML window, your link to load content into it would look something like:


<a href='javascript:parent.frames["myframe"].location.replace("http://yahoo.com")'>Load Yahoo</a>

aongenae
08-24-2007, 07:41 AM
Hi,

Is there a way to get the same result with the div ? :rolleyes:

I mean, the content of my window are in a div like in an example (I prefer that way) but I want to put that div into another page, so I can open window with the same content from different web pages. But I don't want to deal with iframe :o


thanks in advance

ddadmin
08-24-2007, 08:44 AM
Ok you're going to have to explain that again. :)

aongenae
08-24-2007, 09:23 AM
first of all, thank you for your answer.

So, I have the content of my window in a DIV like the window4 example
and everything works great !

Now, I want to put that DIV in an external html file, in order to have window with the same content in different page, without copy/paste the DIV code in every page.

I'm looking for a way to tell the "dhtmlwindow.open(...)" the path of the file where it can find the DIV

ddadmin
08-25-2007, 08:10 AM
Ok, if I understand you correctly, you wish to duplicate the contents of the DIV on multiple pages easily, so multiple windows display this content. Why not just use the iframe or event Ajax option of DHTML Window widget then?

The only way to easily embed a DIV on multiple pages by editing just one file is through something like SSI (server side includes): http://javascriptkit.com/howto/ssi2.shtml If your page is PHP or ASP for example, there are equivalents for it as well.

aongenae
08-25-2007, 09:25 AM
before discoreving Dynamic Drive, I used dhtmlgoodies. In that library, it was possible to put div in a separate html file and call the file while creating the window. I abandon dhtmlgoodies because it was buggy and dynamic drive is much more easier to use and faster.

I wanted to re-use my previous code as much as possible. Moreover, I don't really like iframe, but I think that I have to change my way of working in order to get the result I expect.

I can't use the server side (php or jsp) because I'm in pre-dev state. :(

Thank you for your answer.

ddadmin
08-25-2007, 08:50 PM
Hmmm if you can't use the iframe or ajax option, what this basically comes down to is finding a way to embed an inline content on multiple pages from a single external source. There is really no other way than to use server side to accomplish this, whether it's SSI, the include() feature of PHP, or so on...

aongenae
08-25-2007, 09:53 PM
Great thanks for all your responses.

Like I said, I'm in pre-dev state, in the futur development, I'll use the server side, if I can get rid of that, no problem ! I just want to know what I can and what I can't do...

I want to avoid php or asp or jsp but maybe ajax who's still javascript

Rockonmetal
08-25-2007, 10:22 PM
Oh, i might have another way... without using javascript, I think I know what your going at... I think it only works for IFrame i'll post back once i check to see if it works with a DIV
DIV Code
[HTML]<iframe name="newcontent" id="newcontent"></iframe>[HTML]
Link Code
[HTML]<a href="page" target="newcontent">LINK GO HERE!</a>[HTML]

That works with iframes... I know that for sure...

Rockonmetal
08-25-2007, 10:25 PM
Nope it doesn't work with DIV, but AJAX can... though you can't test it off your hard drive you have to test it on a hosting site...

aongenae
08-26-2007, 08:37 AM
Nope it doesn't work with DIV, but AJAX can... though you can't test it off your hard drive you have to test it on a hosting site...

I'm interrsted in the ajax way... even if it need a server side... because ajax is still javacript.:rolleyes:

like I said in a previous post, the dhtmlgoodies library can load content from DIV (in a separate html file) whitout iframe, maybe I'll take a look at the code to see how. But I want to keep dynamic drive because it's much more stronger, easier, etc.


note I'm not a nativ english speaker so excuse my langage mistake...;)

ddadmin
08-27-2007, 01:31 AM
Well the only way to load regular content (ie: DIV content) from an external source and into the DHTML window without the use of IFRAMEs is Ajax, something like:


<a href="#" onClick="ajaxwin=dhtmlwindow.open('ajaxbox', 'ajax', 'external.htm', 'Ajax Win Title', 'width=650px,height=400px,left=300px,top=100px,resize=0,scrolling=1'); return false">Create/ Open Ajax Window</a>

I haven't looked at the dhtmlgoodies code, but it should be using a similar technique.