Results 1 to 2 of 2

Thread: Modeless window script

  1. #1
    Join Date
    Oct 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Modeless window script

    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>

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Which browser(s)?
    Code:
    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:
    Code:
    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")
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •