Solved

problems with select function

Posted on 1999-01-27
4
157 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
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
PBall earned 50 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
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 …

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

12 Experts available now in Live!

Get 1:1 Help Now