JS help

Out of context: Reply #4

  • Started
  • Last post
  • 9 Responses
  • dc_again0

    you're in a mess there ldww.

    firstly, you're not actually testing anything 'real'. you're testing document.form1.useCard.value, but useCard doesn't have a value as it's a select element. the selected option has a value, but not the select itself. so you need to check that.

    secondly, you're not asking if your 'unreal' value is the same as 'stored'. to do that you have to use TWO equal signs. this performs an equality test on the variables/values on eaither side of the equal signs.

    try this, it should work...

    function selectCard() {
    var thevalue = document.form1.useCard.options[d...
    if( thevalue== "stored"){
    document.form1.NEWcardNum.disabl... = true;
    document.form1.NEWexpMonth.disab... = true;
    document.form1.NEWexpYear.disabl... = true;
    } else {
    document.form1.NEWcardNum.value = "";
    document.form1.NEWcardNum.disabl... = false;
    document.form1.NEWexpMonth.disab... = false;
    document.form1.NEWexpYear.disabl... = false;
    }
    }

View thread