Mouseover dropdown values

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
psmshankar
Forum Commoner
Posts: 96
Joined: Tue Aug 06, 2002 4:25 am
Location: India

Mouseover dropdown values

Post by psmshankar »

Hi

I have a situaion like this:
got a table with code and description.
The description is lenghty..
I have given a form for the user to select the code.
Since displaying the code is obvious for easy reference,
i put the codes in a dropdown and displayed a textarea beside this.
I used onchange event to display the selected code's description in the textarea. Fine ...and even the user can use the up/down arrow key to look for diff codes and thereby see the description...fine..

Now my boss wants to do like this:
when the user clicks the dropdown, it willpull down showing the codes is it not? so when the user move the mouse over the different codes (values in the dropdown), then automatically corresponding description has to be shown in the textarea.
I am not sure whether it can be done or not... becos there is no event to do that as far as i know??? any idea?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

right, there are no events fired for the dropdown-list itself.
you may emulate the feeling of a dropdown with something like

Code: Select all

<html>
	<head>
		<script language="JavaScript">
			function toggleDiv(nameDiv)
			&#123;
				if ( (oDiv = document.getElementById(nameDiv)) != null)
				&#123;
					if (oDiv.style.display.toUpperCase() == "NONE")
						oDiv.style.display = "block";
					else
						oDiv.style.display = "none";
				&#125;
			&#125;
		</script>
	</head>
	<body>
		<button onClick="toggleDiv('d1')">toggle</button>
		<div id="d1" style="position: absolute; width: 50px; height: 100px; display: none">
			<fieldset><legend>choose one</legend>
				a<br/> b<br/> c<br/> d<br/> e<br/>
				1<br/> 2<br/> 3<br/> 4<br/> 5<br/>
			</fieldset>
		</div>
	</body>
</html>
but this is only the very basic visual stuff. I mean this would be a neverending story. Is it worth it? Maybe if you have a good tools/ide supporting you with these kinds of (special d-)effects.

When posting a message on this board there is a link "View more Emoticons". Maybe this approach is sufficient.

And something weird comes to my mind. With IE it is possible to resize a frameset, e.g. from cols="0,*" to cols="100,*". Haven't tested it with other browsers but if it works you may create some kind of sidebar fairly easy.

Or something completely different ;)
Post Reply