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
796 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
Comment Utility
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
Comment Utility
oops...didnt see where you what it off an image...what do you mean off an image??
0
 

Author Comment

by:imagekrazy
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 82

Expert Comment

by:leakim971
Comment Utility
>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
Comment Utility
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
Comment Utility
>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
Comment Utility
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
Comment Utility
>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
Comment Utility
Thank you , it was a great help!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

18 Experts available now in Live!

Get 1:1 Help Now