PDA

View Full Version : DHTML Window widget not updating window content in IE



bradymc
12-29-2007, 08:30 PM
1) Script Title: DHTML Window widget

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

3) I can't seem to get new content to load in the same window from a div in IE.
Here's the initial call:

<a onclick="resortwin=dhtmlmodal.open('divbox2', 'div', 'resort_details', 'Resort Details', 'width=480px,height=360px,center=1,resize=1,scrolling=1'); return false">View resort details</a>
In a div with id 'resort_details' I have several of these:

<a class="red" onclick="resortwin.load('div', 'tt_any_value_resort', 'Resort Details'); return false"><strong>Any Value Resort</strong></a>

It should load what little info I have from another div with id 'tt_any_value_resort'. This method works fine in Firefox, but IE doesn't respond to the click and gives me a JS error that says 'resortwin' is undefined. Also, IE 6 shows the dropdown boxes through the window.

Here's a link to my work in progress: http://www.gomylo.com/clients/3d/registration.html

ddadmin
12-29-2007, 10:06 PM
Instead of loading a DIV (resort_details), have you considered using the IFRAME option of DHTML window to simply load an external page instead? Since your loaded content in turn contains a host of links to other content, it makes a lot more sense (and is more efficient) to simply load an external page, with that page containing regular links to the final destination pages.

bradymc
12-30-2007, 01:14 AM
I was trying to keep the calls all the same as instructed. And since all of the content for each resort ends up being very miniscule in quantity, I was going to just use the div method. I have 30 resorts with a couple of sentences of info and a pic. I'm trying to avoid making 30 new pages for the info.

Can I call an external file that contains the resort_details div info and still call all of the resort info via the div method? In other words, can I use the IFRAME method followed by the DIV method and get away with it?

ddadmin
12-30-2007, 04:15 AM
I was trying to keep the calls all the same as instructed. And since all of the content for each resort ends up being very miniscule in quantity, I was going to just use the div method. I have 30 resorts with a couple of sentences of info and a pic. I'm trying to avoid making 30 new pages for the info.

Can I call an external file that contains the resort_details div info and still call all of the resort info via the div method? In other words, can I use the IFRAME method followed by the DIV method and get away with it?

I see, in that case, it makes sense to do what you're currently doing already. I looked into the problem in more detail. There's definitely something specific to your page that's causing IE to not register a variable when it's being created via the onClick event. For example, this is your initial HTML to launch the DHTML window:


<td width="185"><a onclick="resortwin=dhtmlmodal.open('divbox2', 'div', 'resort_details', 'Resort Details', 'width=480px,height=360px,center=1,resize=1,scrolling=1'); return false">View resort details</a></td>

Which I replaced with something much simpler to try and catch the problem:


<td width="185"><a href="#" onClick="george=5; return false">View resort details</a> <a href="javascript:alert(george)">Report</a></td>

When I click "view resort", then "report", 5 should be alerted, signaling that variable george was correctly defined. In IE, however, it returns undefined. This is the same issue causing IE to return "resortwin" not found.

Most likely the problem is due to some unclosed or invalid HTML on your page throwing IE off. At first I thought it's because your <a> tags are all missing the href attribute, but even adding it in didn't help. I'd start by stripping your page first of everything except the relevant parts to do with this script, and see if you can isolate what HTML (or lack thereof) is causing the problem.

bradymc
12-30-2007, 02:08 PM
I did as you suggested and starting stripping down the page. I thought it may have been some of my hacking at JS that was causing the problem, but I've deducted that the offending tag is <form></form>.

When the call for the window is enclosed within the form tags, IE cries foul (http://www.gomylo.com/clients/3d/test.html).

When you remove the form tags, everything starts working again (http://www.gomylo.com/clients/3d/test2.html).

And that sucks since I need this to work in the flow of a form. Do you have any suggestions on a workaround?

ddadmin
12-30-2007, 10:52 PM
IE sure loves to throw people curve balls eh. :) One thing that works from my testing is this:


<td width="185"><a onclick="parent.resortwin=dhtmlmodal.open('divbox2', 'div', 'resort_details', 'Resort Details', 'width=480px,height=360px,center=1,resize=1,scrolling=1'); return false">View resort details</a></td>

The code in red is new. With that added, you're telling the browser to explicitly add the returned variable to the window object. IE seems to be adding it to the FORM or God knows where.

bradymc
12-31-2007, 04:03 AM
Well, that did the trick!

Yeah, IE deserves a whack in the back of their status bar with a big stick of RAM... a BIG stick of RAM!!!

Thanks for your help and thanks for the great scripts. Where do I donate?

ddadmin
01-02-2008, 06:32 AM
Well, that did the trick!

Yeah, IE deserves a whack in the back of their status bar with a big stick of RAM... a BIG stick of RAM!!!

Thanks for your help and thanks for the great scripts. Where do I donate?

You're welcome. Thanks is more than enough. :)