"Object expected" error with pop-up function in IE6, Firefox fine

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chuck Martin

    "Object expected" error with pop-up function in IE6, Firefox fine

    I am having a most frustrating problem that references, web searches,
    and other resources are no help so far in solving. Basically, I'm trying
    to design a pop-up window to be called with a funciton in a link. that
    function can have parameters for URL and window name passed to it.

    This works peachy in Firefox (1.0). With IE 6 (6.0.29) on two separate
    computers, I get an "onject expected" error. Going to the MS-based
    debugger just tells me the line where the "error' occurs, but I can get
    no explanation.

    Here's the basic code:

    In the HEAD section

    <script language="JavaS cript1.4">
    <!--
    function helpWindow(u, n) {
    var upperLeft = (screen.availWi dth / 2);
    var winHeight = (screen.availHe ight / 2);
    var w = (screen.availWi dth / 2);
    var helpwin = window.open(u, n,
    "toolbar=no,sta tus=no,menubar= no,width=" + w + ",height=" + winHeight +
    ",left=" + upperLeft + ",top=0");
    }

    -->
    </script>

    And in the BODY

    <p>Click <a href="#"
    onclick="javasc ript:helpWindow ('WebHelp/GoalView_Help.h tm',
    'Help');">Help (function, onclick)</a> to view the help. </p>


    (Note that the user agent may wrap lines, but line breaks are only in
    the appropriate places in the actual code.)

    When I click this link, two things happen. First, I get the error noted
    above. Then when I dismiss the error, I get an Explorer-like listing of
    files.

    I've been doing some experimenting, trying some different code from
    different web sites, trying to do the same action directly instead of
    calling the function in the link, etc. Here's the current state of the
    entire code:

    <script language="JavaS cript1.4">
    <!--
    function helpWindow(u, n) {
    var upperLeft = (screen.availWi dth / 2);
    var winHeight = (screen.availHe ight / 2);
    var w = (screen.availWi dth / 2);
    //var params = "toolbar=no,sta tus=no,menubar= no,width=" + w +
    ",height=" + winHeight + ",left=" + upperLeft + ",top=0"
    var helpwin = window.open(u, n,
    "toolbar=no,sta tus=no,menubar= no,width=" + w + ",height=" + winHeight +
    ",left=" + upperLeft + ",top=0");
    //var win = window.open(u, n, "toolbar=no,sta tus=no,menubar= no");
    //var helpwin = window.open(u, n);
    //return false;
    }

    //myWindow = window.open("", "tinyWindow ", 'toolbar,width= 150,height=100' )
    //myWindow.docume nt.write("Welco me to this new window!")
    //myWindow.docume nt.bgColor="lig htblue"

    function changeURL(winNa me, newURL) {
    win = window.open("", winName);
    win.location.hr ef = newURL;
    }

    function anchor_test() {
    window.alert("T his is an anchor test.")
    }

    function greetVisitor()
    {
    var myName = prompt("Please enter your name.", "");
    alert("Welcome " + myName + "!")
    }
    -->
    </script>

    </head>

    <body>
    <p>This page is intended to demonstate an HTML-based Help system
    possibility for GoalView.</p>
    <p>Click <a href="#"
    onclick="javasc ript:helpWindow ('WebHelp/GoalView_Help.h tm',
    'Help');">Help (function, onclick)</a> to view the help. </p>
    <p>Click <a href="javascrip t:helpWindow('W ebHelp/GoalView_Help.h tm',
    'Help');">Help (function, href)</a> to view the help. </p>
    <p>Click <a href="" onclick="window .open('WebHelp/GoalView_Help.h tm',
    'Help',
    'toolbar=no,sta tus=no,menubar= no,width=600,he ight=500,left=0 ,top=0')">Help
    (direct)</a> to view the help. </p>
    <p>Click <a href="" onclick="window .open('WebHelp/GoalView_Help.h tm',
    'Help')">Help (direct, no window parameter)</a> to view the help. </p>
    <FORM>
    <INPUT TYPE="button" VALUE="Help (function)"
    onClick="helpWi ndow('WebHelp/GoalView_Help.h tm', 'Help')">
    <INPUT TYPE="button" VALUE="Help (direct)"
    onClick="window .open('WebHelp/GoalView_Help.h tm', 'Help')">
    <INPUT TYPE="button" VALUE="Load ZDNet (function)"
    onClick="change URL('news', 'http://www.zdnet.com/')">
    <INPUT TYPE="button" VALUE="Load ZDNet (direct)"
    onClick="window .open('http://www.zdnet.com/', 'news')">
    </FORM>
    <p><A HREF="javascrip t:anchor_test() ">Test</a></p>
    <p><a href="javascrip t:greetVisitor( )">Click for a greeting</a></p>
    <p><a href="#" onmouseover="al ert('This is an
    alert.')">&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;</a></p>

    There are 4 links, 4 buttons, then 3 more links.

    Of the first 4 links:

    1. Error message, "No" to debug, nothing else happens
    2. Error message, "No" to debug, nothing else happens
    3. Opens new window, size and position correct, originating page lists
    Explorer-like list of files instead of remaining on the originating page
    4. Opens new full size window, originating page lists Explorer-like list
    of files instead of remaining on the originating page

    Of the 4 buttons:

    1. Error message, "No" to debug, nothing else happens
    2. Opens a new, full-size window, originating page remains
    3. Error message, "No" to debug, nothing else happens (This code was
    taken unmodified from another JS site)
    4. Opens a new, full-size window, originating page remains

    Of the last 3 links:

    1. Error message, "No" to debug, nothing else happens (This code was
    taken unmodified from another JS site)
    2. Error message, "No" to debug, nothing else happens (This code was
    taken unmodified from another JS site)
    3. On mouseover, displayes an alert (This code was taken unmodified from
    another JS site)

    The fact that the pop-up code works fine in Firefox (and that when I
    type javascript: in the Firefox address bar afterwards and get nothing
    in the JavaScript console) leads me to believe that this is an IE
    problem. But what? I've disabled all I can know/think of as far as
    allowing pop-ups in IE.

    If anyone has any clues they can pass on, you know how to un-munge email
    (if you want to reply privately as well as post a solution here).

    thx

    --
    --
    Chuck Martin
    User Assistance & Experience Engineer
    twriter "at" sonic "dot" net www.writeforyou.com

    "I see in your eyes the same fear that would take the heart of me.
    The day may come when the courage of Men fail, when we forsake our
    friends and break all bonds of fellowship. But it is not this day!
    This day, we fight!"
    - Aragorn

    "All you have to decide is what to do with the time that is given you."
    - Gandalf
  • Martin Honnen

    #2
    Re: &quot;Object expected&quot; error with pop-up function in IE6, Firefoxfine



    Chuck Martin wrote:

    [color=blue]
    > This works peachy in Firefox (1.0). With IE 6 (6.0.29) on two separate
    > computers, I get an "onject expected" error.[/color]

    [color=blue]
    > <script language="JavaS cript1.4">[/color]

    Use
    <script type="text/javascript">
    and I think the IE problem will go away although I haven't looked at
    details of the rest of your post.

    --

    Martin Honnen

    Comment

    • Chuck Martin

      #3
      Re: &quot;Object expected&quot; error with pop-up function in IE6, Firefoxfine

      Martin Honnen wrote:[color=blue]
      >
      >
      > Chuck Martin wrote:
      >
      >[color=green]
      >> This works peachy in Firefox (1.0). With IE 6 (6.0.29) on two separate
      >> computers, I get an "onject expected" error.[/color]
      >
      >
      >[color=green]
      >> <script language="JavaS cript1.4">[/color]
      >
      >
      > Use
      > <script type="text/javascript">
      > and I think the IE problem will go away although I haven't looked at
      > details of the rest of your post.
      >[/color]


      Martin,

      That worked. I think you from the bottom of my heart.

      I also used your response to go to another part of one of my JavaScript
      books to find that the language attribute is deprecaetd. That wasn't
      what was taught in my Internet Programming class just last spring.

      My utmost thanks.

      --
      --
      Chuck Martin
      User Assistance & Experience Engineer
      twriter "at" sonic "dot" net www.writeforyou.com

      "I see in your eyes the same fear that would take the heart of me.
      The day may come when the courage of Men fail, when we forsake our
      friends and break all bonds of fellowship. But it is not this day!
      This day, we fight!"
      - Aragorn

      "All you have to decide is what to do with the time that is given you."
      - Gandalf

      Comment

      Working...