View Full Version : DHTML Window widget (v1.1): How to <body onload... IE 6/7

12-31-2008, 12:45 AM
1) Script Title: DHTML Window widget (v1.1)

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

3) Describe problem: I added Window Widget to my page. I want to call the script onload, so I added this to the body tag:

<body onLoad="divwin=dhtmlwindow.open('divbox', 'div', 'somediv', 'Strongid Shine Wellness Package', 'width=360px,height=460px,center=1 ,resize=1,scrolling=1')">

It works in Firefox; the hidden div pops up when window loads. But in Windows IE 6 or 7 the hidden div does not pop up. There are no js errors.

Is there a way to make it work in IE 6/7?


12-31-2008, 01:02 AM
Hmm there's no reason why it wouldn't work in IE. Using the first demo in the zip file as an example, this works for me in IE6:

<body onLoad='googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")'>

However, to make the above more unobtrusive, you can call dhtmlwindow.addEvent() to call the desired function on window load:

dhtmlwindow.addEvent(window, function(){
googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
}, "load")

12-31-2008, 06:40 PM

Thanks for the quick response. For some reason, I cannot the <body onload= to work in IE 6 or 7, but works fine in Firefox/Safari. (Of course, your example uses an external web page where my example is using a hidden div in the current page)

However, I DID get the onload function you created to work; dhtmlwindow.addEvent()

Thanks a LOT for your help.