?
Solved

problems with select function

Posted on 1999-01-27
4
Medium Priority
?
175 Views
Last Modified: 2010-04-09
Hi, i am trying to make a Drop down menu wich changes a picture.
i am doeing something wrong but i don't know what?
could somebody please correct it (there is something wrong in the function).

my html code is :

<html>
<script language="JavaScript">

function choose(){
 document.images.selebpic.src = "../images/celeberties/"+document.select.celebselect.selected.name;
}
</script>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PicShit Main</title>
</head>

<body background="../images/wolken2.gif">

<form name="celeberties">
  <p><select name="celebselect" size="1" onchange="choose();">
    <option selected value="victorya.jpg">Victoria Adams</option>
    <option value="pam.jpg">Pamela Anderson </option>
    <option value="jennif.jpg">Jennifer Aniston</option>
    <option value="appleg.jpg">Christina Applegate </option>
    <option value="tyra.jpg">Tyra Banks</option>
    <option value="tbingham.jpg">Traci Bingham </option>
    <option value="williams.jpg">Vanessa Williams </option>
  </select></p>
</form>

<p><img id="selebpic" src="victoria.jpg" width="332" height="600"></p>
</body>
</html>



Pleaze help me Thanx,
ruben
0
Comment
Question by:rtieland
[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
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
PBall earned 200 total points
ID: 1845726
Yummy yum yum yum :)

It's actually spelled celebrities. :)

function choose(obj){
 document.images["selebpic"].src = "../images/celeberties/"+this.options[this.options.selectedIndex].value;
}

<select name="celebselect" size="1" onchange="choose(this);">



0
 

Expert Comment

by:DavidME
ID: 1845727
To start, shouldn't that
<img id="selebpic" src="victoria.jpg" width="332" height="600">
be
SRC="../images/victorya.jpg"
?

This is, are the images stored in ../images? What's the proper name of the file?

Do you get an error message? Which?
0
 
LVL 4

Expert Comment

by:martinag
ID: 1845728
In PBall's choose(obj) function, change all occurances of 'this' to 'obj'.

Martin
0
 
LVL 6

Expert Comment

by:PBall
ID: 1845729
Oh yeah, hehe..thanks for point that out martin :)
(bonk side of head -- must be some loose screws there)
hehe
0

Featured Post

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Suggested Courses

800 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