PDA

View Full Version : DHTML Window Widget fix



advanceddork
04-23-2008, 07:41 PM
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm
When using multiple DHTML windows with iframes, the focus can only be set by clicking on the title bar of the DHTML window, this easy fix allows focus to be set by clicking anyware in the content area.



else if (contenttype=="iframe"){
t.contentarea.style.overflow="hidden" //disable window scrollbars, as iframe already contains scrollbars
if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName!="IFRAME") //If iframe tag doesn't exist already, create it first
t.contentarea.innerHTML='<iframe src="" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+t.id+'"></iframe>'
window.frames["_iframe-"+t.id].location.replace(contentsource) //set location of iframe window to specified URL
window.frames["_iframe-"+t.id].onmousedown=function(){t.show();}
}


1 new line of code,
window.frames["_iframe-"+t.id].onmousedown=function(){t.show();}