SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2003
    Location
    eldersburg, md
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    BODY ONLOAD won't open new window??

    I have a routine called openLesson(l,p), where l=leson number, p=page number.
    If I have a link on my page such as:
    --
    <a class="menulink" href="#" onclick="javascript:return openLesson(1,1);">Introduction</a>
    --
    that works fine.
    But if I have an onload command such as:
    <body onload="openLesson(1,1)"> something weird happens: any ALERT in the subroutine shows up (to prove I'm getting there), but the new window doesn't open, but no JS errors.
    (Here's the openLesson code; I've tried it with and without a "return false" a the end.)
    function openLesson(num, startPage) {
    var lessonName = "lsn" + paddedLeft(num, 3, '0');
    var url = "./" + lessonName + "/" + lessonName + lessonExtension + "?startPage=" + startPage;
    var windowName = "lessonWindow";
    var windowOptions = "width=1000, height=730, resizable=1, toolbar=0, scrollbars=1, menubar=1, directories=0, status=0";

    lessonWindowHandle = window.open(url, windowName, windowOptions);
    alert("ol="+num+",p="+startPage);
    return false;
    }

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I'm guessing you have a popup blocker installed, or you're using a browser that blocks them natively (i.e. Firefox or Opera). Blockers will kill any new window that is supposed to spawn on page load.

  3. #3
    SitePoint Member
    Join Date
    Aug 2003
    Location
    eldersburg, md
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face Lol

    LOL, that was it... I didn't realize the onload open would be read as being an ad, but that makes sense... ZoneAlarm was just protecting me from myself...


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
  •