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
799 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
displaying 3 dropdownlist  horizontally 3 32
Generate PDF's using TCPDF - Initial Set Up 9 31
MySQL-Design Help 12 43
PHP $_POST vs asp request 4 27
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.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to dynamically set the form action using jQuery.

749 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