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
800 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 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