SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Hybrid View

  1. #1
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    whats wrong with this?

    <head>
    <script language="JavaScript">
    function openWindow() {

    var url= "main.html";
    var name="new";
    popupWin = window.open(url, name, 'scrollbars=yes,resizable=yes,width=800,height=600')
    }
    </script>
    </head>

    <body onload="openwindow();">
    Free Science Homework Help
    http://www.physicsforums.com

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    Code:
    <head> 
    <script language="javascript" type="text/javascript"> 
    function openWindow()
    {
    popupWin = window.open('main.html','new',config='scrollbars=yes,resizable=yes,width=800,height=600') 
    } 
    </script> 
    </head> 
    
    <body onload="openWindow()">
    Also of note, JavaScript is case sensitive. If you look at your code, in the body you had onload="openwindow();" when it should be onload="openWindow()".

    Anyway, see if that works.
    Last edited by Aes; Dec 13, 2001 at 22:30.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or this (more general),

    Code:
    <head> 
    <script language="javascript" type="text/javascript"> 
    function openWindow(file,title) {
      popupWin = window.open(file,title,config='scrollbars=yes,resizable=yes,width=800,height=600') 
    } 
    </script> 
    </head> 
    
    <body onload="openWindow('main.html','new')">

  4. #4
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They both do exactly the same thing, goof!

    Yours just contains more lines of coding.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  5. #5
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Aes,

    While Paul S' example may do the same as your code; it does it approximately, not exactly. Your example is 'hardwired'; that is, the url and title are explicity stated. If dethfire needs to open more than one window, s/he will have to copy your code for each window, make the appropriate changes and then rename each copy of both the function and the call.

    Paul's code, on the other hand, is generic and can be used for more than one window/script/page. If more than one window needs to be opened, the developer only needs to change the call: openWindow('main.html','new')

    Overall, Paul's code is much better and far more useful.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  6. #6
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you say so Vince. I would like to deeply thank you for pointing out the obvious inferiority of my script. What on earth was I thinking?
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  7. #7
    Spam Can Kill!!! Disk-t's Avatar
    Join Date
    Jul 2001
    Location
    n/a
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah. Case sensitivity is one of the parts of JS which I really don't like.

  8. #8
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Aes,

    Re:
    If you say so Vince. I would like to deeply thank you for pointing out the obvious inferiority of my script. What on earth was I thinking?
    This is what prompted my response:
    They both do exactly the same thing, goof!
    Yours just contains more lines of coding
    And I don't recall pointing out 'inferiority'; I simply stated that Paul's code was better and more useful.

    Sarcasm will get you everything you desire

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  9. #9
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes; I'm quite fond of sarcasm.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  10. #10
    Are you ready for BSD? Marshall's Avatar
    Join Date
    Dec 2001
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *checks his watch... hmm, almost 4am*

    Case sensitivity is fine. What we really need is a more intellegent JavaScript interperter built into all of our favorate Web browsers :-)

    And while they're at it, no doubt they'll find a number of new security bugs. Yet another patch for IE @ http://www.microsoft.com/windows/ie/...75/default.asp.

    - Marshall

    (Now back to your regularly scheduled reality...)

  11. #11
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heh -- that will likely be a while. No one is exactly "jumping the guns" on improving their JavaScript interpreters.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.


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
  •