?
Solved

problems with select function

Posted on 1999-01-27
4
Medium Priority
?
180 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

649 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