Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > onmouseover and onmouseout event

Reply
Thread Tools

onmouseover and onmouseout event

 
 
Samir
Guest
Posts: n/a
 
      11-03-2004
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>
 
Reply With Quote
 
 
 
 
George Hester
Guest
Posts: n/a
 
      11-04-2004
"Samir" <(E-Mail Removed)> 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('testin g.htm','test','width=101,height=100');" onmouseout="tester.close();">Try this</div>

I believe 100x100 is the smallest window you can make this way.
 
Reply With Quote
 
 
 
 
Ivo
Guest
Posts: n/a
 
      11-04-2004
"George Hester" <(E-Mail Removed)> wrote:
"Samir" <(E-Mail Removed)> wrote:
>> I would like to get a little window (101x73) to appear on onmouseover
>> and go away onmouseout.

>
> <div

onmouseover="javascript:tester=window.open('testin g.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


 
Reply With Quote
 
George Hester
Guest
Posts: n/a
 
      11-04-2004
"Ivo" <(E-Mail Removed)> wrote in message news:41898f43$0$45948$(E-Mail Removed)...
> "George Hester" <(E-Mail Removed)> wrote:
> "Samir" <(E-Mail Removed)> wrote:
> >> I would like to get a little window (101x73) to appear on onmouseover
> >> and go away onmouseout.

> >
> > <div

> onmouseover="javascript:tester=window.open('testin g.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','tes t','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
__________________________________
 
Reply With Quote
 
Zifud
Guest
Posts: n/a
 
      11-04-2004
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.
 
Reply With Quote
 
Samir
Guest
Posts: n/a
 
      11-04-2004
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.
 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      11-04-2004
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.


 
Reply With Quote
 
Zifud
Guest
Posts: n/a
 
      11-05-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: onMouseOver and onMouseOut Dave HTML 0 09-08-2010 09:04 AM
onmouseover and onmouseout does not work Kurda Yon HTML 1 02-10-2008 12:32 PM
How to trap onclick event handler amidst onmouseleave, onmouseover, and onmouseout JJA Javascript 0 10-31-2007 04:53 PM
(DHTML) using onmouseover and onmouseout to swap images jazzerus@gmail.com Computer Support 1 01-07-2007 09:49 AM
How to change onmouseover and onmouseout dynamically Tor Inge Rislaa ASP .Net 3 08-06-2003 04:43 PM



Advertisments