Winopen function and browser behavior

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marty Morris

    Winopen function and browser behavior

    I used the following script to allow me to bring up a list of events
    for a given year by simply hovering the mouse over the filename. As
    follows --

    <script Language="JavaS cript">
    function winopen1(){
    msg1=open
    ("","WINDOW1"," toolbar=no,loca tion=no,directo ries=no,status= no,menubar=no,s crollbars=no,re sizable=no,copy history=no,widt h=550,height=20 0");
    msg1.location=" 1989H.htm"}
    </Script>

    Then....

    <a href="1989H.htm " onMouseOver="wi nopen1();return true;"
    onMouseOut="msg 1.close();retur n true;">1989</a></font></td>

    This is one example .... this is repeated about 20 times in the
    program, one for each year of our history...

    It works fine ... but not on all the browsers in our office. Most work
    fine ... others (all IE) work fine on some dates; other dates, when
    you hover, flash a blank page repeatedly until you move the mouse
    away; almost as though it is looping ...

    I notice that "about:blan k" flashes briefly before the called page
    comes up ... but that appears to be normal.... I have checked and
    rechecked all coding, all brackets and semi-colons ... and it works
    perfectly -- for me and for a few others.

    Any ideas?

    Thanks ...
  • Grant Wagner

    #2
    Re: Winopen function and browser behavior

    Marty Morris wrote:
    [color=blue]
    > I used the following script to allow me to bring up a list of events
    > for a given year by simply hovering the mouse over the filename. As
    > follows --
    >
    > <script Language="JavaS cript">
    > function winopen1(){
    > msg1=open
    > ("","WINDOW1"," toolbar=no,loca tion=no,directo ries=no,status= no,menubar=no,s crollbars=no,re sizable=no,copy history=no,widt h=550,height=20 0");
    > msg1.location=" 1989H.htm"}
    > </Script>
    >
    > Then....
    >
    > <a href="1989H.htm " onMouseOver="wi nopen1();return true;"
    > onMouseOut="msg 1.close();retur n true;">1989</a></font></td>
    >
    > This is one example .... this is repeated about 20 times in the
    > program, one for each year of our history...
    >
    > It works fine ... but not on all the browsers in our office. Most work
    > fine ... others (all IE) work fine on some dates; other dates, when
    > you hover, flash a blank page repeatedly until you move the mouse
    > away; almost as though it is looping ...
    >
    > I notice that "about:blan k" flashes briefly before the called page
    > comes up ... but that appears to be normal.... I have checked and
    > rechecked all coding, all brackets and semi-colons ... and it works
    > perfectly -- for me and for a few others.
    >
    > Any ideas?
    >
    > Thanks ...[/color]

    about:blank flashes because you're calling window.open() without a URL.

    The problem is most likely that win1.location doesn't yet exist as an object when you try to access it. I'd bet you're getting a JavaScript
    error something about Access Denied.

    I don't understand why you open the window, then set it's location. I also don't understand why you'd hard-code all the individual URLs all
    over the place, try this:

    <script type="text/javascript">
    function winOpen(theURL, theTarget) {
    var windowRef = window.open(the URL, theTarget,
    "toolbar=no,loc ation=no,direct ories=no,status =no,menubar=no, scrollbars=no,r esizable=no,cop yhistory=no,wid th=550,height=2 00");
    return windowRef;
    }
    </script>

    <a href="1989H.htm " onMouseOver="wi ndow[this.href] = winOpen(this.hr ef, this.target);re turn true;"
    onMouseOut="if (window[this.href]) window[this.href].close();return true;">1989</a>

    Now each link gets it's own popup reference so you know what window you're closing, you're specifying the location in one place (the HREF
    attribute of the link) and you can use the same function for *every* link that does the same thing instead of having 20 functions that all do
    the same thing.

    --
    | Grant Wagner <gwagner@agrico reunited.com>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    * http://devedge.netscape.com/library/...ce/frames.html
    * Internet Explorer DOM Reference available at:
    * http://msdn.microsoft.com/workshop/a...ence_entry.asp
    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
    * http://www.mozilla.org/docs/web-deve...upgrade_2.html


    Comment

    Working...