Results 1 to 1 of 1

Thread: Accessing Javascript External file arrays

  1. #1
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Accessing Javascript External file arrays

    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
    Last edited by Roses89; 04-19-2010 at 03:03 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •