onmouseover and onmouseout event

S

Samir

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>
 
G

George Hester

Samir said:
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.
 
I

Ivo

George Hester said:
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.
 
G

George Hester

Ivo said:
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.

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.
 
Z

Zifud

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.
 
S

Samir

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.
 
R

Richard Cornford

George Hester wrote:
<div
onmouseover="tester=window.open
('testing.htm','test','width=101,height=100');"
onmouseout="self.close();">Try this</div>
... . 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.
 
Z

Zifud

Samir said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top