PDA

View Full Version : Populating DHTML Widget window



dbldee
04-28-2007, 04:15 PM
1) Script Title: DHTML Widget window

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


a) I tried unsuccesfully to have the window open on page load
b) Can files with dynamic content be loaded in the window?

example (http://www.econsumersearch.com/windowfiles/widgetwindow.html#)

ddadmin
04-29-2007, 08:54 AM
If you're using the iframe option to load a DHTML window, that page can essentially contain anything, including dynamic content. As long as it renders correctly on its own, it shouldn't be any different when that page is loaded .via iframe inside the DHTML window instead.

dbldee
04-30-2007, 01:09 PM
Unfortunately I am using AJAX.

How is dynamic content handled in AJAX?
All pages are on the same site, in the same directory

ddadmin
04-30-2007, 08:28 PM
The main issues relating to a page fetched via Ajax have to do with JavaScrips and CSS codes correctly being transferred over:

1) In IE, they generally will not be transferred over. This means you need to include these JavaScript/CSS code on the main page that's including the fetched page instead.

2) An even more fundamental issue affects all browsers (ie: Firefox), and stems simply from the way Ajax pages are included- dynamically, using the .innerHTML property for example. This means if your external page contains a JavaScript that dynamically outputs something on runtime in that page, for example:


document.write("My name is John")

That output will not shown up when it's included on the main page via Ajax, as this is a runtime operation, which Ajax isn't (it's asynchronous or dynamic).

If your external page contains JavaScripts or CSS, in general, the iframe option is the easiest way to get things working correctly for the DHTML window widget.

twohawks
10-07-2007, 07:23 AM
I found some interesting discussion on this here and there.
I have been trying to use the idea from a solution/workaround suggested here (http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=20&t=006435).

I tried placing variations of

var styles=t.getElementsByTagName("style")
for (var i=0; i<styles.length; i++){
eval(styles[i].text)
}
var scripts=t.getElementsByTagName("script")
for (var i=0; i<scripts.length; i++){
eval(scripts[i].text)
}
var divs=t.getElementsByTagName("div")
for (var i=0; i<divs.length; i++){
eval(divs[i].text)
}


...in the dhtmlwindow.js file in either init or open function sections, and I thought I was observing something, but....

...Well... maybe one of you geniuses will see this and go "AHA!" and know what to do with something like this?!? It seems logical that once the content is loaded you could re-eval the text in there, and cause the imported html page to actually render -- no?!

Cheers,
TwoHawks

twohawks
10-07-2007, 07:35 AM
SEE ALSO:
Dynamic innerHTML content (ajax) (http://boxover.swazz.org/forum/dynamic-innerhtml-content-ajax-t251-1.html)

Eval’ing with IE’s window.execScript (http://ajaxian.com/archives/evaling-with-ies-windowexecscript)

Hmm.... maybe this is the deal here...
nerd ~Going Global (http://nerd.metrocat.org/2006/07/going-global)

I hope some of you experts here check this out and, if there is a solution lurking here, will help point it out and help us noobs to better understand how to be applying it here ;^)

Cheers,
TwoHawks