onmouseover and onmouseout event

Discussion in 'Javascript' started by Samir, Nov 3, 2004.

  1. Samir

    Samir Guest

    I would like to get a little window (101x73) to appear on onmouseover and
    go away onmouseout. the onclick works.


    <html>

    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>

    <body>

    <div onclick="alert('testing')">testing mouseover</div>

    </body>

    </html>
    Samir, Nov 3, 2004
    #1
    1. Advertising

  2. "Samir" <> wrote in message news:Xns9596993497259samirhotmailcom@63.218.45.41...
    > I would like to get a little window (101x73) to appear on onmouseover and
    > go away onmouseout. the onclick works.
    >
    >
    > <html>
    >
    > <head>
    > <meta http-equiv="Content-Language" content="en-us">
    > <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    > <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    > <meta name="ProgId" content="FrontPage.Editor.Document">
    > <title>New Page 1</title>
    > </head>
    >
    > <body>
    >
    > <div onclick="alert('testing')">testing mouseover</div>
    >
    > </body>
    >
    > </html>


    You are not caputuring the onmouseover or onmouseout events. What you have captured is the onclick event. And then you get a modal dialog box which requuires action before anything else in the page fires. What you want is something like this:

    <div onmouseover="javascript:tester=window.open('testing.htm','test','width=101,height=100');" onmouseout="tester.close();">Try this</div>

    I believe 100x100 is the smallest window you can make this way.
    George Hester, Nov 4, 2004
    #2
    1. Advertising

  3. Samir

    Ivo Guest

    "George Hester" <> wrote:
    "Samir" <> wrote:
    >> I would like to get a little window (101x73) to appear on onmouseover
    >> and go away onmouseout.

    >
    > <div

    onmouseover="javascript:tester=window.open('testing.htm','test','width=101,h
    eight=100');" onmouseout="tester.close();">Try this</div>

    I would suggest using a special division which you show and hide by
    manipulating its style (visibility or display property) or className,
    instead of a separate window. It is an ordinary <div> tag, can be any size,
    also smaller than 100x100, and is not sensitive to pop-up blocking software.
    More importantly, drop the "javascript:" pseudo-protocol from the
    onmouseover event handler. They are not the place for specifying the type of
    script, you do that with a http header of meta tag. Most browsers will
    ignore it and run the script anyway, but they are not required to do so.
    --
    Ivo
    Ivo, Nov 4, 2004
    #3
  4. "Ivo" <> wrote in message news:41898f43$0$45948$...
    > "George Hester" <> wrote:
    > "Samir" <> wrote:
    > >> I would like to get a little window (101x73) to appear on onmouseover
    > >> and go away onmouseout.

    > >
    > > <div

    > onmouseover="javascript:tester=window.open('testing.htm','test','width=101,h
    > eight=100');" onmouseout="tester.close();">Try this</div>
    >
    > I would suggest using a special division which you show and hide by
    > manipulating its style (visibility or display property) or className,
    > instead of a separate window. It is an ordinary <div> tag, can be any size,
    > also smaller than 100x100, and is not sensitive to pop-up blocking software.
    > More importantly, drop the "javascript:" pseudo-protocol from the
    > onmouseover event handler. They are not the place for specifying the type of
    > script, you do that with a http header of meta tag. Most browsers will
    > ignore it and run the script anyway, but they are not required to do so.
    > --
    > Ivo
    >
    >


    Yeah actually it should have been something like this:

    <div onmouseover="tester=window.open('testing.htm','test','width=101,height=100');" onmouseout="self.close();">Try this</div>

    Although your suggestion of using a <DIV and CSS is commendable it is not what the op asked for. I believe it is
    constructive to provide what ops ask for first then if you have the time move on and provide what you think is a
    better solution. Of course that's just me. No matter how poor a op's desire may be in the eyes of an expert it is
    good ettiquete to provide what is asked for if you know how to do it. The op can learn later if they want
    alternative solutions. Sometimes we learn by our mistakes. Sometimes not. But that is the ops lesson to learn for
    him or her self. Please do not fly off the handle for what I've said. It's just a suggestion.

    --
    George Hester
    __________________________________
    George Hester, Nov 4, 2004
    #4
  5. Samir

    Zifud Guest

    George Hester wrote:
    [...]
    > Although your suggestion of using a <DIV and CSS is commendable it is not what the op asked for. I believe it is
    > constructive to provide what ops ask for first then if you have the time move on and provide what you think is a
    > better solution. Of course that's just me. No matter how poor a op's desire may be in the eyes of an expert it is
    > good ettiquete to provide what is asked for if you know how to do it. The op can learn later if they want
    > alternative solutions. Sometimes we learn by our mistakes. Sometimes not. But that is the ops lesson to learn for
    > him or her self. Please do not fly off the handle for what I've said. It's just a suggestion.
    >


    If you took the time to provide advice to someone who didn't ask for
    it, you should have provided the advice to the person that did in the
    first place.

    Your sample code (if it opens a pop-up at all) will close the parent
    window - not the child. Either way, your div sets a trap that does
    things to a users interface that they will likely get very frustrated
    trying to deal with. I didn't read where Samir asked "Please let me
    really annoy my visitors", so please provide full advice if you are
    going to assist with creating very unreliable and annoying UI
    "features".

    And last I knew, Samir was a mans name so it's fine to refer to "him".

    Cheers, Zif.
    Zifud, Nov 4, 2004
    #5
  6. Samir

    Samir Guest

    I was more wanting an effect like ie....you know when you have a text or
    picture and you can have an option of putting some caption on it...well I
    would like to have that happen when the mouse is over the text it opens a
    caption like thing to show another htlm page or something like that.

    thanks.
    Samir, Nov 4, 2004
    #6
  7. George Hester wrote:
    <snip>
    > <div
    > onmouseover="tester=window.open
    >('testing.htm','test','width=101,height=100');"
    > onmouseout="self.close();">Try this</div>

    <snip>
    >... . No matter how poor a op's desire may be in
    > the eyes of an expert it is good ettiquete to
    > provide what is asked for if you know how to do it.

    <snip>

    So you think that when someone expresses the desire to shoot themselves
    in the foot, an appropriate response would be to hand them a loaded gun?
    And apparently motivated by some perverse (considering your past
    behaviour) notion of politeness?

    Fortunately your inability to recognise when someone is trying to shoot
    themselves in the foot is somewhat mitigated by your total inability to
    load the gun you passed them (The script above is up to your usual
    standard i.e. worse than useless even for the stated task).

    Richard.
    Richard Cornford, Nov 4, 2004
    #7
  8. Samir

    Zifud Guest

    Samir wrote:
    > I was more wanting an effect like ie....you know when you have a text or
    > picture and you can have an option of putting some caption on it...well I
    > would like to have that happen when the mouse is over the text it opens a
    > caption like thing to show another htlm page or something like that.
    >
    > thanks.


    Then use Ivo's suggestion, often also called "dynamic HTML". Have a
    look at <URL: http://www.w3schools.com> for some instruction.

    Zif.
    Zifud, Nov 5, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tor Inge Rislaa
    Replies:
    3
    Views:
    16,111
    Jerry III
    Aug 6, 2003
  2. Kurda Yon
    Replies:
    1
    Views:
    695
    Andy Dingley
    Feb 10, 2008
  3. Dave
    Replies:
    0
    Views:
    458
  4. Neredbojias

    Re: onMouseOver and onMouseOut

    Neredbojias, Sep 9, 2010, in forum: HTML
    Replies:
    0
    Views:
    495
    Neredbojias
    Sep 9, 2010
  5. JJA
    Replies:
    0
    Views:
    150
Loading...

Share This Page