473,779 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Learning...NEED HELP!!

3 New Member
Ok this really shouldn't be that hard...but I can not figure out whats' wrong for the life of me. I am brand new to "coding" and have thus far just built basic sites with Dreamweaver, but am going through my CIW certs, and this is an exercise i am feeling a little "dumb'' on.... any help....

Question exactly as it's worded: Create a Web page that contains an HTML form, a list box, a button and an <img> tag. Populate the list box with at least 3 people's names and the names of three images located in the same directory; you will also need those image files accessible from the server. Use the 'onClick' event of the button object to read the attributes of the list box that store the currently selected names and associated image name. Use the JavaScript 'Load' method to script the <img> tag to load the image associated with the name.

Now my "instructor " made a super simple example that worked, but I can not for the life of me duplicate it and actually get it to work. I am sure there are "better" ways to acheive this goal, but I am trying to do it how they want... here is the "instructor s" example he gave me


<html>
<head>
<title> blah blah blah</title>

<script type="text/javascript">
function Load()
{
document.getEle mentById("Image s").src=
document.getEle mentById("faces ").value
}
</script>
</head>


<body>

<img id="Images" src="face1.jpg" >

<select name="faces">
<option value=""> Select a face
<option value="face1.jp g">Face1
<option value="face1.jp g">Face2
<option value="face1.jp g">Face3
<option value="face1.jp g">Face4
</select>

<input type="submit" onClick="Load() " value="selecxt" >

</body>
</html>

--------------------------------------------


Does this make sense?? I really need some advice from anyone that knows how to "complete the exercise" i am getting really frustrated....

THANKS SO MUCH!!!!!!!!!!! !!!!
Jun 1 '07 #1
4 1457
r035198x
13,262 MVP
Ok this really shouldn't be that hard...but I can not figure out whats' wrong for the life of me. I am brand new to "coding" and have thus far just built basic sites with Dreamweaver, but am going through my CIW certs, and this is an exercise i am feeling a little "dumb'' on.... any help....

Question exactly as it's worded: Create a Web page that contains an HTML form, a list box, a button and an <img> tag. Populate the list box with at least 3 people's names and the names of three images located in the same directory; you will also need those image files accessible from the server. Use the 'onClick' event of the button object to read the attributes of the list box that store the currently selected names and associated image name. Use the JavaScript 'Load' method to script the <img> tag to load the image associated with the name.

Now my "instructor " made a super simple example that worked, but I can not for the life of me duplicate it and actually get it to work. I am sure there are "better" ways to acheive this goal, but I am trying to do it how they want... here is the "instructor s" example he gave me


<html>
<head>
<title> blah blah blah</title>

<script type="text/javascript">
function Load()
{
document.getEle mentById("Image s").src=
document.getEle mentById("faces ").value
}
</script>
</head>


<body>

<img id="Images" src="face1.jpg" >

<select name="faces">
<option value=""> Select a face
<option value="face1.jp g">Face1
<option value="face1.jp g">Face2
<option value="face1.jp g">Face3
<option value="face1.jp g">Face4
</select>

<input type="submit" onClick="Load() " value="selecxt" >

</body>
</html>

--------------------------------------------


Does this make sense?? I really need some advice from anyone that knows how to "complete the exercise" i am getting really frustrated....

THANKS SO MUCH!!!!!!!!!!! !!!!
1.) Java != Javascript. Moved to Javascript forum.
2.) When posting code, please make use of the code tags so that the code is easier to read. (It even looks prettier).
3.) What exactly is the problem. Did you write some code yourself and get errors? Do you understand the code that was written by your teacher?
Jun 1 '07 #2
DjShifta
3 New Member
1.) Java != Javascript. Moved to Javascript forum.
2.) When posting code, please make use of the code tags so that the code is easier to read. (It even looks prettier).
3.) What exactly is the problem. Did you write some code yourself and get errors? Do you understand the code that was written by your teacher?
--------

Hey! Okm sorry, what do you mean by make use of the Code Tags? Do you mean the # sign at the top of the message display??

Man i feel so lame, I am JUST getting into all this and get Lingo confused....
I got that code from the teacher, and he got the code to work on the schools computer where he had his image files stored. I retyped the Code EXACTLY, on my computer and substituted my images, and thought I matched the <select name"......name here......"> with the... document.getEle mentById("....n ame here....") which he told me must match. but it's not working.....

The Code that i wrote in my first message is exactly what he gave me to use, but when I plug in my images (bob.jpg - joe.jpg - joh.jpg and so on...) i can' not get it to work.

Any help is greatly appreciated as I am litteraly like 4weeks into my CIW training and have so much info thrown at me it is difficult to remember all the different code and lingo terms right now!!!! I am really trying to grasp this example, but the instructors really aren't that great....

THANKS!!
Jun 1 '07 #3
ronnil
134 Recognized Expert New Member
Hi there

When working with document.getEle mentById you must give the HTML element who's value you wish to retrieve an id. (name and id are two different things ;) )

so instead of
Expand|Select|Wrap|Line Numbers
  1. <select name="faces">
you will have to use
Expand|Select|Wrap|Line Numbers
  1. <select name="faces" id="faces">
this should get it to work properly
Jun 1 '07 #4
DjShifta
3 New Member
Hi there

When working with document.getEle mentById you must give the HTML element who's value you wish to retrieve an id. (name and id are two different things ;) )

so instead of
Expand|Select|Wrap|Line Numbers
  1. <select name="faces">
you will have to use
Expand|Select|Wrap|Line Numbers
  1. <select name="faces" id="faces">
this should get it to work properly


Thank you! I will try this when I get home from work! :)

Thanks for the help!!!!
Jun 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1657
by: Nathan Pinno | last post by:
Hi all, I need help figuring out how to fix my code. I'm using Python 2.2.3, and it keeps telling me invalid syntax in the if name == "Nathan" line. Here is the code if you need it. #This program asks for a password, then asks for the user's name after the correct password has been supplied. The computers response will vary, # depending on the name inputted. print "Program Author: Nathan Pinno"
17
1973
by: EkteGjetost | last post by:
This is definitely not the smart thing to do as far as my learning goes, but desperate situations call for desperate measures. The final lab for my introduction to C programming class is due tomorrow. I was on vacation when we went over how to read files, so basically my only resources are the book, the course notes, and the examples. Unfortunately for me, none of them are usefull at all, so pretty much i don't have a clue as to what i...
6
2028
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I have a drop down list which store all the different brands of product.When i selected the particular brand from the drop down list, it will display all the products with the selected brand in a datagrid. I have this error when i select a brand from the drop down list. Blow is my code,anyone can help me to solve my error,which part of my code went wrong? Really thanx and very appreciate your help in advanced.. I have been stucked...
16
5449
by: manmit.walia | last post by:
Hello All, I have tried multiple online tools to convert an VB6 (bas) file to VB.NET file and no luck. I was hoping that someone could help me covert this. I am new to the .NET world and still learning all help would be greatly apperciated. Attribute VB_Name = "Module1" Option Explicit
1
1587
by: Benton2862 | last post by:
I need help with and array for a program that acts like a cash register. The user will input an items price and then there payment. It will tell you the change and then tell you what kinda of change to use, see example: Use JOptionPane to take inputs from the user and display the results. Example: -------- If the user enters Amount Due = 5.52 // First Input from the User Amount Given = 10.00 // Second Input from the User ...
3
1285
by: Amy Newsome | last post by:
TO DO TASK Need help with programming the ADD button I have a textbox called txtinput where I will enter a task After hitting an add button the program should put the text into a listbox called lstoutput for example read a book
3
3539
by: Rich Squid | last post by:
Hello Here's my basic problem: On my asp.net form page I have a DetailsView (default mode=edit) bound to a AccessDataSource control. Users can successfuly update a databound template field, but I wanted to add a custom validator to check that the account number they are entering exists in a table in the Access Database.
2
2455
by: XML Beginner | last post by:
I have an XML file that contains values that my application needs, so it knows which database to connect to. It also contains a configuration option so that I can specify which node to return values from. For example, the XML file is meant to return the values from node"config2", because the "configoption" node's value is that. I'm extremely new to XML and the code that accesses it, but from what I could gather from materials read, I got...
28
1806
by: G8tors | last post by:
I have a fantasy football league that I am keeping stats for in an Access Database. I need help coming up with a way to calclulate the winning % for each team for their entire career. What I have is a table with the following fields: Fantasy Team Season Week W/L Own Score Vs Opponent Opponent Score Game type
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.