This function works as intended in Firefox, but not IE 6 or Opera.

Discussion in 'Javascript' started by Bob, Oct 1, 2006.

  1. Bob

    Bob Guest

    I have a small JS function to edit "code". This function works as
    intended in Firefox, but not IE 6 or Opera 9. I suppose this is an old
    story, but is there a work around? I have two forms on the page,
    passing one by argument, and the other "GetClass" is hard coded. I'm
    trying to prevent my DB from having the same code, unless it is "ZZZ".
    This function is called with an onChange event in the input field
    "newcode".

    function checkcode(aform) {
    var code =aform.newcode.value.toUpperCase()
    if (code=="ZZZ") return
    newopt = aform.newclass.valueto.UpperCase() + " | " + code;
    for (i=0; i<document.GetClass.key.length; i++) {
    k= document.GetClass.key.options.value.indexOf(code);
    if ((k>0) && (document.GetClass.key.options.value !== newopt))
    alert("Warning: This Class Code is already used by " +
    document.GetClass.key.options.value)
    }
    }
     
    Bob, Oct 1, 2006
    #1
    1. Advertisements

  2. Bob

    Bob Guest

    This is just a typo
    > newopt = aform.newclass.valueto.UpperCase() + " | " + code;


    I really do have this is the JS:

    newopt = aform.newclass.value.toUpperCase() + " | " + code;
     
    Bob, Oct 1, 2006
    #2
    1. Advertisements

  3. Bob

    Bob Guest

    This is just a typo
    > newopt = aform.newclass.valueto.UpperCase() + " | " + code;


    I really do have this is the JS:

    newopt = aform.newclass.value.toUpperCase() + " | " + code;
     
    Bob, Oct 1, 2006
    #3
  4. Bob

    Bob Guest

    I have a small JS function to edit "code". This function works as
    intended in Firefox, but not IE 6 or Opera 9. I suppose this is an old
    story, but is there a work around? I have two forms on the page,
    passing one by argument, and the other "GetClass" is hard coded. I'm
    trying to prevent my DB from having the same code, unless it is "ZZZ".
    This function is called with an onChange event in the input field
    "newcode".

    function checkcode(aform) {
    var code =aform.newcode.value.toUpperCase()
    if (code=="ZZZ") return
    newopt = aform.newclass.value.toUpperCase() + " | " + code;
    for (i=0; i<document.GetClass.key.length; i++) {
    k= document.GetClass.key.options.value.indexOf(code);
    if ((k>0) && (document.GetClass.key.options.value !==
    newopt))
    alert("Warning: This Class Code is already used by " +
    document.GetClass.key.options.value)
    }
     
    Bob, Oct 1, 2006
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dalberg
    Replies:
    29
    Views:
    4,438
    kchayka
    Nov 3, 2004
  2. Jeff
    Replies:
    2
    Views:
    471
    Mike Massonnet
    Jan 30, 2006
  3. Bob
    Replies:
    24
    Views:
    1,891
  4. Jeff
    Replies:
    3
    Views:
    1,318
  5. patrickkellogg
    Replies:
    3
    Views:
    329
  6. Bob
    Replies:
    3
    Views:
    194
    Randy Webb
    Jul 14, 2006
  7. Replies:
    2
    Views:
    215
    Peter Michaux
    Jun 6, 2007
  8. Fox
    Replies:
    5
    Views:
    184
Loading...