Can I open windows of different sizes with one script?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Can I open windows of different sizes with one script?

  1. #1
    Join Date
    Jan 2006
    Posts
    10

    Question Can I open windows of different sizes with one script?

    Hallo

    Utter Java newbie here, so this may be a silly question, I don't know.

    I have the following script, which opens a new window of a certain size. Is it possible to put variables in for height and width, so I can open windows of several different sizes with the same script? In which case, how? (And how do I call it?)

    Thanks

    -----

    <script language='javascript'>
    //-- This function opens the new, empty window named floater.
    function openWindow(url) {
    winStats='toolbar=no,location=no,directories=no,menubar=no,'
    winStats+='scrollbars=yes,width=400,height=400'
    if (navigator.appName.indexOf("Microsoft")>=0) {
    winStats+=',left=10,top=10'
    }else{
    winStats+=',screenX=10,screenY=10'
    }
    floater=window.open(url,"",winStats)
    }
    //-->
    </script>

  2. #2
    Join Date
    Jan 2006
    Posts
    10
    I've got a reply from another forum, but I thought I'd post it here, in case anyone else wants to know how to do this:

    <script language='javascript' type="text/javascript">
    //-- this function opens the new, empty window named floater
    function openWindow(url,iW,iH) {
    winStats='toolbar=no,location=no,directories=no,menubar=no,'
    winStats+='scrollbars=yes,width=' + iW + ',height=' + iH
    if (navigator.appName.indexOf("Microsoft")>=0) {
    winStats+=',left=10,top=10'
    }else{
    winStats+=',screenX=10,screenY=10'
    }
    floater=window.open(url,"",winStats)
    }
    //-->
    </script>

    to call it:

    <a href="javascriptpenWindow('http://www.blahblahblah.com/html',400,400);">link</a>

    [NB. = colon, little o]

Similar Threads

  1. But in the end, it is still UNIX
    By Jeff Jones in forum Open Source
    Replies: 6
    Last Post: 07-11-2002, 10:37 AM
  2. Replies: 0
    Last Post: 04-29-2002, 07:43 AM
  3. Creating architecture to access different databases
    By Dennis in forum Architecture and Design
    Replies: 44
    Last Post: 08-23-2001, 07:09 AM
  4. ?API NT Compatability?
    By Dennis in forum VB Classic
    Replies: 10
    Last Post: 02-15-2001, 03:52 AM
  5. Replies: 8
    Last Post: 01-19-2001, 05:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center