Solved

problems with select function

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Web forms being filled out by bots 4 50
Place text over image using CSS 6 48
Create tabs to show divs 9 35
Diminish Pop-up  in 3 seconds 7 45
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

840 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