PDA

View Full Version : Modeless window script



redmercurypr
10-14-2005, 05:40 PM
Hi, I've been using the modeless window script and it works great. When I try to use a page in my computer that I'm building instead of an http url, it doesn't work with that. Please bear with me I'm a newbie. Instead of using a url from a site I'm using c:\documents and ...\..\ . Here is the script.

<script>

//Modeless window script- By DynamicDrive.com
//for full source code and terms of use
//visit http://www.dynamicdrive.com

function modelesswin(url,mwidth,mheight){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"","help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
else
eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")')
}

//configure URL and window dimensions (width/height)
modelesswin("http://yahoo.com",600,600)

//To load via link, use something like below:
//<a href="javascript:modelesswin('http://yahoo.com',600,400)">Click here</a>
</script>

Twey
10-14-2005, 07:11 PM
Which browser(s)?

eval('window.showModelessDialog(url,"","help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
else
eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")')
Just a little good practice: you almost never need to use eval(). In this case, you want to use:

window.showModelessDialog(url,"","help:0;resizable:1;dialogWidth:"+mwidth+"px;dialogHeight:"+mheight+"px")
else
window.open(url,"","width="+mwidth+"px,height="+mheight+"px,resizable=1,scrollbars=1")