#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Some kind of Javascript error


    So I have this web page code, which works (sort of) in Firefox, but only the select works in IE8. To make it work in Firefox the alert(null); has to be there or it won't go to the href given when the myloc == "MySrch". I don't get any feedback errors, which is really confusing.

    SqlStr = "Select DISTINCT Unit From Employee Where PhoneBook = 1 Order by Unit;"
    Set UniNme = Connection.Execute(SqlStr)
    Response.Write "<select id='Unit' onChange='Change(this.id)'>"
    Response.Write "<option value=''>Choose Unit</option><br>"
    Response.Write "<option value='Everyone'>Everyone</option><br>"
    Do While Not UniNme.EOF
    Response.Write "<option value='"&UniNme("Unit")&"'>"&UniNme("Unit")&"</option><br>"
    UniNme.MoveNext
    Loop
    Response.Write "</select><br>"

    Response.Write "Name Search: <input type='text' id='MySrch' onChange='Change(this.id)'>"



    The javascript function is
    function Change(myloc) {
    if (myloc == "Unit") {
    var myindex = document.getElementById(myloc).selectedIndex;
    myvalue = document.getElementsByTagName("option")[myindex].value;
    } else {
    var myvalue = document.getElementById(myloc).value;
    }

    document.cookie = "Temp1="+escape(myloc);
    document.cookie = "Temp2="+escape(myvalue);

    document.location.href="AEmployees.asp?action=Change";

    alert(null);
    }
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Feb 2004
    Location
    Mobile, Alabama
    Posts
    4,023
    Rep Power
    1285
    you should post this in the Javascript forum.

IMN logo majestic logo threadwatch logo seochat tools logo