Roses89
04-19-2010, 02:54 AM
Hey guys,
I needed help in how i could access an array from an external javascript file and use the values in a drop down menu.Is it possible firstly?and secondly if it is, then how?
Heres the code plus javascript:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<script type="text/javascript" src = "AssignOne.js"></script>
<title>Welcome To Hardly Normal-Employee Information Form</title>
</head>
<body>
<h3>Job Title:*</h3>
<select name="Title" size="1" id="jobTitles">
<option value="PC">----Please Choose----</option>
<option value="SP">Sales Person </option>
<option value="SM">Sales Manager </option>
<option value="Dept">Department </option>
<option value="Man">Manager </option>
<option value="WP">Warehouse Person </option>
<option value="WM">Warehouse Manager </option>
</select>
</body>
</html>
Javasctipt EXTERNAL file:
var jobTitles = new Array();
jobTitles[0] = "Sales Person";
jobTitles[1] = "Sales Manager";
jobTitles[2] = "Department Manager";
jobTitles[3] = "Warehouse Person";
jobTitles[4] = "Warehouse Manager";
The complete and actually question is :
"item d, Job Title. This field is mandatory, use appropriate JavaScript to dynamically generate an appropriate input device from the jobTitles array which is in the AssignOne.js file"
I dont understand what thats supposed to mean:S but i assumed it meant to take the values from the array.:S could someone please explain what that actually means and how im supposed to do that?:S
I needed help in how i could access an array from an external javascript file and use the values in a drop down menu.Is it possible firstly?and secondly if it is, then how?
Heres the code plus javascript:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<script type="text/javascript" src = "AssignOne.js"></script>
<title>Welcome To Hardly Normal-Employee Information Form</title>
</head>
<body>
<h3>Job Title:*</h3>
<select name="Title" size="1" id="jobTitles">
<option value="PC">----Please Choose----</option>
<option value="SP">Sales Person </option>
<option value="SM">Sales Manager </option>
<option value="Dept">Department </option>
<option value="Man">Manager </option>
<option value="WP">Warehouse Person </option>
<option value="WM">Warehouse Manager </option>
</select>
</body>
</html>
Javasctipt EXTERNAL file:
var jobTitles = new Array();
jobTitles[0] = "Sales Person";
jobTitles[1] = "Sales Manager";
jobTitles[2] = "Department Manager";
jobTitles[3] = "Warehouse Person";
jobTitles[4] = "Warehouse Manager";
The complete and actually question is :
"item d, Job Title. This field is mandatory, use appropriate JavaScript to dynamically generate an appropriate input device from the jobTitles array which is in the AssignOne.js file"
I dont understand what thats supposed to mean:S but i assumed it meant to take the values from the array.:S could someone please explain what that actually means and how im supposed to do that?:S