Select box - reporting hover over value

J

Jason

Hi there,

I have a label for a selectbox beside a selectbox. The label uses javascript to change it's value depending on the value selected within the select box. This, at the moment, only works when the value of the select box has been selected by a mouse click (not by keyboard weirdly).

What I would like to happen is the value of the hovered over value gets reported when the cursor is over the option - kind of like on mouse over or css :hover.

Any ideas on how to achieve this? I'm using jquery (not a favourite here from what I've read).

Cheers,
J
 
J

Jukka K. Korpela

Jason said:
I have a label for a selectbox beside a selectbox.

Good idea.
The label uses
javascript to change it's value depending on the value selected
within the select box.

Odd idea. The label is supposed to relate to control, to a user interface
for getting information from the user, not to a particular state of the
control or some specific information received. Changing the label probably
causes confusion.

But perhaps you didn't mean a label, i.e. some text associated with the
This, at the moment, only works when the value
of the select box has been selected by a mouse click (not by keyboard
weirdly).

A URL would help by letting us see what you have tried
What I would like to happen is the value of the hovered over value
gets reported when the cursor is over the option - kind of like on
mouse over or css :hover.

Well that's a different issue. Hovering does not mean selection. And I
cannot figure out what you mean by "the value of the hovered over value".
Any ideas on how to achieve this?

It's not clear at all what "this" is.
 
J

John Nagle

The NOBR tag is deprecated. It's been obsolete for years.

And it's in every Google ad result on Google search pages.
Google uses it to keep the magnifying-glass icon next to the
search result link. Interestingly, only ads have a NOBR;
the regular search results, have very similar layout, but
use a SPAN with a class to keep the magnifying-glass icon
in place.

I'm working on a Firefox plug-in that puts a translucent
rating icon on top of search results and ads. This is done
by modifying the DOM to add an extra DIV around the search
result, then another DIV with a different layer containing
the image. This works fine for the entries which don't use
NOBR, but interferes with clicking on ones which do. The
inserted DIV makes the area covered by the NOBR unclickable.
The translucent icon is in the correct place atop the ad
in both cases, so the DIV is being properly inserted.

The result is that you see the ads, but can't click on them.
(Which is not the intent, although it could be an option.)

Here's what the unmodified DOM looks like:

Google search result structure (non-ad)

OL Search result block
LI One search result
DIV
DIV
SPAN class "tl"
H3 First line of result
A The clickable link
#text Text of link
EM
#text Text of link
#text Text of link
BUTTON Magnifying glass icon
DIV Text of result
... text, with format as needed
SPAN Final line of search result
CITE Container for display URL
#text Display URL
SPAN Container for "Cached" and "Similar"
A
#text "Cached"
A
#text "Similar"
LI Next search result
... as above.


Google ad result structure

OL
LI
DIV
DIV
H3 Ad link container
A Ad link
#text Ad link text
NOBR Obsolete HTML feature
#text
BUTTON Magnifying glass icon
SPAN Body of ad
#text Ad text
BR
#text Ad text
BR End of ad body
DIV Display URL container
CITE Display URL form
#text Display URL text


Note that NOBR in there. That's interfering with something. It
behaves differently than a SPAN of class "t1".

Any ideas?

John Nagle
 
J

Jukka K. Korpela

John said:
The NOBR tag is deprecated. It's been obsolete for years.

Technically, NOBR has never been part of any HTML specification, even though
it is widely supported by browsers and very useful. The HTML5 drafts include
it but forbid it; that is, they define it and require browsers to support it
but specify that authors must not use it; they call it "entirely obsolete"
and "nonconforming".
The inserted DIV makes the area covered by the NOBR unclickable.

Have you checked whether this happens with the same structure when presented
as HTML markup, statically? My test with Firefox 4 shows no problem with
simple markup that corresponds to your description. Maybe it's something
else on the page, or maybe it's related to how the DOM has been modified. In
any case, a URL would be essential.

If NOBR is a problem, you could try replacing it by a SPAN with a suitable
style (white-space: nowrap). It is slightly less reliable (browser honor
different suggestions on preventing line breaks in different ways, normally
so that NOBR has the widest support), but usually good enough.
 
J

John Nagle

Technically, NOBR has never been part of any HTML specification, even
though it is widely supported by browsers and very useful. The HTML5
drafts include it but forbid it; that is, they define it and require
browsers to support it but specify that authors must not use it; they
call it "entirely obsolete" and "nonconforming".


Have you checked whether this happens with the same structure when
presented as HTML markup, statically? My test with Firefox 4 shows no
problem with simple markup that corresponds to your description. Maybe
it's something else on the page, or maybe it's related to how the DOM
has been modified. In any case, a URL would be essential.

If NOBR is a problem, you could try replacing it by a SPAN with a
suitable style (white-space: nowrap). It is slightly less reliable
(browser honor different suggestions on preventing line breaks in
different ways, normally so that NOBR has the widest support), but
usually good enough.

I'll have to try that. Google has so much Javascript executing
that it's hard to tell what's going on.

John Nagle
 
J

John Nagle

I'll have to try that. Google has so much Javascript executing
that it's hard to tell what's going on.

The problem seems to be related to Google's mouseover/hover
code picking up the wrong item after I've inserted my icon.
Google's new "instant preview" thing seems to be the problem.

John Nagle
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top