Solved

problems with select function

Posted on 1999-01-27
4
159 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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 …

919 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

13 Experts available now in Live!

Get 1:1 Help Now