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
798 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

825 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