Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Labels on drop down menus?

If add the ALT tag when an user mouse over an image he can view a little label with the content setted in the alt tag: <IMG ID="Picture7" height=33 width=143 SRC="Images/a_buttonlGUID.gif" BORDER=0 ALT="Guida">

I would like to know if it is possible to let a similar label appearing when the user mouse over on the selected element of a drop down menu.

Thank you.
Regards
0
Ilalove
Asked:
Ilalove
  • 7
  • 5
  • 3
  • +1
1 Solution
 
DreamMasterCommented:
You mean like a select box? Or a javascript generated dropdown?

Cause as far as I know there is no way to get anything like the ALT tag on the select box...

For any text items...you could use the title property...

Max.
0
 
COBOLdinosaurCommented:
You should resolve your old open questions (some with urgent in the title) before you ask more questions.  You may find that experts make you wait as long for a response as you have made them wait for resolution of your open Qs.

Drop down menu?  Expanding collapsing table or select?

Cd&
0
 
IlaloveAuthor Commented:
COBOLdinosaur if I didn't close some of my previous question this was because the proposed solutions not satisfied me. But I will follow your advice and I will delete them.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
COBOLdinosaurCommented:
Okay, now wahat about the drop down? Is it a select?

Cd&
0
 
IlaloveAuthor Commented:
Yes dear COBOLdinosaur it is a select
0
 
DreamMasterCommented:
Well like I said (and correct me Cd& if I'm wrong) as far as I know there is no way to show Alt text information on selectbox items...

Max.
0
 
COBOLdinosaurCommented:
Okay then you are pretty limited. The tool tips have to fire off of a
mouseover.  The option doesn't support that.  You can put a tooltip up
for mouse over on the select, but not the individual items.  The HTML
standard actually specifies support for a mouseover event on the option
but neither IE or Netscrape have implemented it.

Cd&
0
 
IlaloveAuthor Commented:
Dear Cobol I need to have that "label" ONLY on the first selected option...
0
 
IlaloveAuthor Commented:
Dear Cobol I need to have that "label" ONLY on the first selected option...
0
 
COBOLdinosaurCommented:
I think I can get that.  Have to experimnet a little be back shortly.

Cd&
0
 
IlaloveAuthor Commented:
I deposit here other 200 points ONLY for you: I will give these points only yo you because I know you are one of the most skilled person in EE on these topics.
Just a thing: this is very urgent x me.
0
 
DreamMasterCommented:
Duh....why would he be on nr1 otherwise....

Geez...sorry but this sounds like a lot of drooling going on here.....

Max.
0
 
COBOLdinosaurCommented:
I'm going to give you what I have up to now.  I can't get back to it until
the morning.

I can load from the mousedown event for the select to bring up a tip and have
it go with the mouse, I'll convert that to just load co-ordinates when I have
the rest figured out.

I still have not found a way to detect the mouse over the select but
I'm trapping the mouse movement, so I think it is just a matter of
gettin the x y co-ordinates to to be the firing mechanism on the mouse
move event.

I'll post what I have so you can look at it and see if i'm go ing in the
right direction.

<html>
<head>
<title>Changing Font Styles</title>
<script language="JavaScript">
<!--
var TRAP=false;
var CURREL=false;
var thepos=0;
function trap()
{
   if (TRAP)
   {
      return;
   }
   else
   {
   TRAP=window.event;
   trapx=TRAP.x;
   trapy=TRAP.y;
   }
}
function dragEvnt()
{
if (TRAP)
{
var WIN=window.event;
CURREL.style.top=WIN.y+10;
thepos=WIN.y
CURREL.style.left=WIN.x+10;
if       ((trapy<=(thepos+25)) && (trapy>=(thepos-25)))
{
  CURREL.style.visibility="visible";
}
else
{
   CURREL.style.visibility="hidden";
}
}
}
//-->
</script>

</head>
<body onLoad="CURREL=document.all['tooltip']" onMousemove="dragEvnt()">

<form name="fonts">
<table border=1>
<tr><td>
<select name="fontSel" onmousedown="trap()">
<option title="one" value="times" > select face
<option value="Times"> Times
<option value="Arial">  Arial
<option value="Courier"> Courier
</select>
</td>
</tr>
</table>
</form>
<div id="tooltip" style="background-color:lightyellow;color:black;
border:1px solid black;visibility:hidden;width:175;z-index:10;position:absolute">
This is the text of the tooltip
</div>

</body>
</html>


Cd&
0
 
COBOLdinosaurCommented:
Thanks for the A, but there is still more to do on it.  I post the improved version a little later.

Cd&
0
 
COBOLdinosaurCommented:
Well, this is not the perfect tool tips but I think it is the best way to
simulate tool tips for a select.  Something the can't be done for real.

This second version offers different approach the tip box stays in a static
position instead of tracking the cursor. that avoids the problem of dragging
under the select.  Now way to get the tip on top I even tried using a iframe
for the tip. The movement can be used by using the mousemove event, but it
is really wonky.

The positioning of the tip box is still base on cursor position during focus
and can be adjusted by changing the offsets.

The added feature in this version is the dynamic text in the tip.  An array
is used to change the text based on the selected option.

Any combination of features from the two is possible, and there are probably
additional effects possible with the use of various combinations of events.

There is no way t d any of this in Netscrap 4.x. It is possible it could be
at least partly implemented in NS6, but i have not played much with 6, so
I don't what is really possible.

Cd&



<html>
<head>
<title>Changing Font Styles</title>

<script language="JavaScript">
<!--
var tips = new Array(5);
tips[0]="this is the default text";
tips[1]="this is text for the first selection option";
tips[2]="tip for the second option";
tips[3]="all your bases are belong to us";
tips[4]="final tip";

var TRAP=false;
var CURREL=false;
var thepos=0;
function trap()
{
   if (TRAP)
   {
      dragEvnt()
   }
   else
   {
   TRAP=window.event;
   trapx=TRAP.x+15;
   trapy=TRAP.y+15;
   dragEvnt();
   }
}
function dragEvnt()
{
if (TRAP)
{
CURREL.style.top=trapy;
CURREL.style.left=trapx;
CURREL.style.visibility="visible";
}
}
function hideit()
{
   TRAP=false;
   CURREL.style.visibility="hidden";
}
//-->
</script>

</head>
<body onLoad="CURREL=document.all['tooltip'];CURREL.innerHTML=tips[0]">
<form name="fonts">
<table border=1>
<tr><td>
<select name="fontSel" onFocus="trap()" onBlur="hideit()"
   onChange="CURREL.innerHTML=tips[this.selectedIndex+1]">
<option title="one" value="times" > select face
<option value="Times"> Times
<option value="Arial">  Arial
<option value="Courier"> Courier
</select>
</td>
</tr>
</table>
</form>
<div id="tooltip" style="background-color:lightyellow;color:black;width:150;
border:1px solid black;visibility:hidden;width:175;z-index:10;position:absolute">
&nbsp;
</div>
</body>
</html>


0
 
RedCCameleonCommented:
Ilalove,
It's very good of you to trust certain people, however, being NOT the number #1 in a topic area does not always mean that the expert is NOT 100% perfect. It would be appreciated by other experts if you also listen to their comments and provide additional input.

Reading this question it seems as if COBOLdinosaur did provide you with the best possible answer, but you did not listen to the other experts. Listening to other experts might give you additional information about the question you have / had. It is, of course, up to you to decide what to do.

RedCCameleon,
EE moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now