Solved

How to make a drop down list in java script or Html/ php that comes off a image

Posted on 2011-02-15
11
797 Views
Last Modified: 2012-05-11
How  do i write  the code  for a drop down menu list off a image
0
Comment
Question by:imagekrazy
  • 5
  • 4
  • 2
11 Comments
 

Expert Comment

by:smallinternetsolutions
ID: 34901109
java script :

<FORM name="guideform">
<SELECT name="guidelinks">
<OPTION SELECTED value="jex6.htm">Page 1
<OPTION value="jex7.htm">My Cool Page
</SELECT>
&nbsp;&nbsp;
<INPUT type="button" name="go" value="Go!" onClick="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> </FORM>

HTML:

html>
<head>
<title>My Page</title>
</head>
<body>
<form name="myform" action="http://www.mydomain.com/myformhandler.cgi" method="POST">
<div align="center">
<select name="mydropdown">
<option value="Milk">Fresh Milk</option>
<option value="Cheese">Old Cheese</option>
<option value="Bread">Hot Bread</option>
</select>
</div>
</form>
</body>
</html>
0
 

Expert Comment

by:smallinternetsolutions
ID: 34901120
oops...didnt see where you what it off an image...what do you mean off an image??
0
 

Author Comment

by:imagekrazy
ID: 34901939
When i put my mouse over the image  the drop down  opens and gives me a choice of listed texts
0
 
LVL 82

Expert Comment

by:leakim971
ID: 34902762
Check this :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	function showDD() {
		document.getElementById("dropdown").style.display = "block";
	}
</script>
</head>
<body>
<img src="http://www.bombayharbor.com/productImage/0672272001199678936/Led_Open_Sign.jpg" width="64" onclick="showDD()" />
<select id="dropdown" style="display:none;position:absolute;left:10px;top:10px" multiple="multiple" onclick="this.style.display='none'">
	<option>Select...</option><option>2</option><option>3</option>
</select>
</body>
</html>

Open in new window

0
 

Author Comment

by:imagekrazy
ID: 34902931
wow  that is cool, now, i have some more questions.
 how do i make the  size of the drop down box bigger and have the drop down box in a  different color, and also  i put in a link in the option area but it didn't work, so how do  i get the text to link.
thanks for your  help
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 82

Expert Comment

by:leakim971
ID: 34902973
>how do i make the  size of the drop down box bigger
add width:320px in the style attribute for example

>and have the drop down box in a  different color
add background-color:#3C6 in the style attribute for example

>i put in a link in the option area but it didn't work
I don't its possible. You can change location url if the user click on it :  onclick="location.href=this.text"




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	function showDD() {
		document.getElementById("dropdown").style.display = "block";
	}
</script>
</head>
<body>
<img src="http://www.bombayharbor.com/productImage/0672272001199678936/Led_Open_Sign.jpg" width="64" onclick="showDD()" />
<select id="dropdown" style="display:none;position:absolute;left:10px;top:10px;width:320px;background-color:#3C6" multiple="multiple" onclick="this.style.display='none'">
	<option>Select...</option>
    <option onclick="location.href=this.text">http://www.google.com</option>
    <option onclick="location.href=this.text">http://www.experts-exchange.com</option>
</select>
</body>
</html>

Open in new window

0
 

Author Comment

by:imagekrazy
ID: 34903174
wow your good, okay final questions,  now if i want the drop down box to come on when the mouse hovers over it, instead of  me clicking on the image, how do i do that? ,and also how do i remove the scroll that is on the side of the  box when i preview it in fire fox but its not there when its  in IE?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 34903191
>http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_24305395.html
line 13 replace onclick by onmouseover

>and also how do i remove the scroll that is on the side of the  box when i preview it in fire fox but its not there when its  in IE?
check this thread : http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_24305395.html

0
 

Author Comment

by:imagekrazy
ID: 34903309
I clicked on the  link you sent me and they all are saying you cant remove that, but  i have web site  that  shows it can be done , http://www.campshanearizona.com/request_info.php 

 and the mouse over works but it stays on how do it go off when i remove the mouse over like the page i have in the link above
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34903339
>I clicked on the  link you sent me and they all are saying you cant remove that, but  i have web site  that  shows it can be done , http://www.campshanearizona.com/request_info.php 

It's not a select-listbox but a select-dropdown :)

>and the mouse over works but it stays on how do it go off when i remove the mouse over like the page i have in the link above
add  onmouseout="this.style.display='none'" line 14
<select id="dropdown" style="display:none;position:absolute;left:10px;top:10px;width:320px;background-color:#3C6" multiple="multiple" onclick="this.style.display='none'" onmouseout="this.style.display='none'">

Open in new window

0
 

Author Closing Comment

by:imagekrazy
ID: 34903477
Thank you , it was a great help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now