Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    works in Netscape, NOT in IE, WHY?

    This is an array (javascript) that populates one drop-down depending on what the first drop-down value is:
    //this JS populates the second drop-down
    <!-- Begin
    team = new Array(
    new Array(
    new Array("Please select a name", "VP"),
    new Array("David", "David<dg@entertainment.com>"),
    new Array("Hugh", "Hugh<hm@entertainment.com>"),
    new Array("Stephen", "Stephen<sm@woodbineentertainment.com>")
    ),
    new Array(
    new Array("Please select a name", "VP"),
    new Array("Tom", "Tom<tv@entertainment.com>"),
    new Array("Frank", "Frank<fl@entertainment.com>")
    ),
    new Array(
    new Array("Please select a name", "VP"),
    new Array("Steve", "Steve<sw@woodbineentertainment.com>")
    )
    );
    function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
    var i, j;
    var prompt;
    // empty existing items
    for (i = selectCtrl.options.length; i >= 0; i--) {
    selectCtrl.options[i] = null;
    }
    prompt = (itemArray != null) ? goodPrompt : badPrompt;
    if (prompt == null) {
    j = 0;
    }
    else {
    selectCtrl.options[0] = new Option(prompt);
    j = 1;
    }
    if (itemArray != null) {
    // add new items
    for (i = 0; i < itemArray.length; i++) {
    selectCtrl.options[j] = new Option(itemArray[i][0]);
    if (itemArray[i][1] != null) {
    selectCtrl.options[j].value = itemArray[i][1];
    }
    j++;
    }
    // select first item (prompt) for sub list
    selectCtrl.options[0].selected = true;
    }
    }
    // End -->
    //This is the first drop-down, not the whole form
    <select name="Dept" onChange="fillSelectFromArray(this.form.VPName, ((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]));">
    <option value="-1">Select Your Dept.</option>
    <option value="1">Administration </option>
    <option value="2">Accounting </option>
    <option value="3">Broadcasting </option>
    </select>

    //second drop-down
    <!--select name="AuthBy"-->
    <select name="VPName">
    <option value="VP"><b><font face="Arial, Helvetica, sans-serif" size="2">Please
    select a name</font></b></option>
    </select>

    The problem is that i am using JS for a 'Back' link,
    <a href = 'javascript:history.back();'>Change Request</a>
    for the next page, but when the user uses the 'Back' link, the second-dropbox never populates in IE (5.x or 6).
    Anyone have an idea why? THANKS!!!!

  • #2
    New Coder
    Join Date
    Jul 2002
    Location
    USA, East Coast
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post shot in the dark

    I didnt get a chance to fully understand the code.

    But if you think the back link is the cause of your qualm. have you tried this:


    <a href="javascript:void(0)" onclick="history.back();return false">Change Request</a>

    dont know if that fixes anything...

    something was told to me before about using javascript: in the href link and JS not working...

    -S. Bob

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks, but i've figured it out...
    i had to add an onChange again to the end of the form


  •  

    Posting Permissions

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