hajjo 0 Junior Poster
function showModalSummary(path, ownerWin, pos, passObj, onClose, title, setFocusEnabled)
{
  
  path = rootPath + path;
  


  if(!title) title = "";
  //
  var  doc, dl, features='';
	if(!pos) pos=new Object();
	if(!pos.width)  pos.width=300;
	if(!pos.height) pos.height=200;
	if(!pos.left && pos.left!=0)   pos.left=(screen.availWidth-pos.width)/2;
	if(!pos.top  && pos.top!=0)    pos.top=(screen.availHeight-pos.height)/2;
	if(isMoz)
	{
		pos.height-=27; pos.width-=6;
		features = features.replace(/:/g, "=").replace(/;/g, ",");
	}

	features = 'width=' + pos.width + 'px, height=' + pos.height + 'px, left='+pos.left+', top='+pos.top+', resizable=yes' + features;
	
	 	dl = ownerWin.open(String('about:blank'), null, features);
[B]				
	var doc = dl.document;[/B]
	

	doc.open(); 
	var myDoc = "<title>" + title + "</title>" +
	          "<body style='overflow:scroll; font-family:tahoma; font-size:12px; font-weight:bold;'>" +
	               "<div style='cursor: wait; position: absolute; left: 0%; top: 0%; background: Transparent; padding: 3px; width: 100%; height: 100%' id='divWait' >"+
	               "<table width='98%' style='height: 98%' border='0' cellpadding='0' cellspacing='0'> <tr>	<td><table width='98%' style='height: 98%' border='0' cellpadding='0' "+
				   " cellspacing='0'><tr> <td align='center' valign='center'> <table border='0' cellpadding='0' cellspacing='0'><TR><TD style='border-top:1px solid black;border-right:1px solid black;border-left:1px solid black;'>"+
				   "<img id='waitImg' src='../../../skins/PlzWait.jpg' /></TD></TR>	<TR><TD style='border-bottom:1px solid black;border-right:1px solid black;border-left:1px solid black;'><img id='waitImg' src='../../../skins/Load2.gif' /></TD>"+
				   "</TR></table></td></tr></table></td></tr></table></div>"+
	               "<iframe frameborder='0' src='"+path+"' style='width:100%; height:100%'></iframe>" +
	          "</body>";
	       
	doc.write(myDoc); 
                  
        doc.close();
	doc.body.style.margin=0;
	dl.passObj = passObj;
	dl.parentWin = ownerWin;
	ownerWin.dialog = dl;
	dl.showHideWait = function(show, noImage)
	{
 	   doc.body.childNodes[0].style.display = show? "" : "none";
	}
	setTimeout(function()
	{
	  var frm = doc.body.childNodes[1];
//  	  events.addEvent(frm, "load", function(){dl.showHideWait(false);});
  	  frm.contentWindow.document.location.href=path;
  	  
  	   var pageLocation = frm.contentWindow.document.location.href;
  	   
       if(pageLocation.indexOf('#') != -1 && (pageLocation.indexOf('#') == (pageLocation.length - 1)))
          frm.contentWindow.document.location.href = pageLocation.substr(0,pageLocation.length - 1);
          
  	   events.addEvent(dl, "unload", function(){
      	//setOnParentFocus(dl, null);
    	  if(onClose) onClose(dl.passObj);
  	  });
	}, 0);
	//
	

	return false;
}

first time i click buttonand call the above method, the page is opened normally..a window popups..
however i return to original page, click the button again to open the popup..i get javascript error in the bold part + the window opened goes to blank page.


anyone got help?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.