Web Analytics Made Easy -
StatCounter Function problem - CodingForum

Announcement

Collapse
No announcement yet.

Function problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function problem

    Hi all

    I have different select boxes. If one of them has a specific value some other select boxes should disabled.

    I made this with the following function:

    Code:
    function SetDisabled()
    {
    if(document.myform.n09_schw.value =2)
      {
    	document.myform.n11_zvb.value ='';
    	document.myform.n12_zvs.value ='';
    	document.myform.n10_erg.value ='';
    
    	document.myform.n11_zvb.disabled =true;
    	document.myform.n12_zvs.disabled =true;
    	document.myform.n10_erg.disabled =true;
      }
      if(document.myform.n09_schw.value !=2)
      {
    	document.myform.n11_zvb.disabled =false;
    	document.myform.n12_zvs.disabled =false;
    	document.myform.n10_erg.disabled =false;
      }
    return true;
    }
    The problem is now, that the select of the box is stays always on the value 2 when I select another value (text) then the box jumps back to value 2.

    Thanks for your help
    Bart

  • #2
    if(document.myform.n09_schw.value =2)

    That line should be

    if(document.myform.n09_schw.value == 2)

    because your version actually assigns 2 to the value, it's not doing a comparison. Remember, = is assignment, == is comparison. That should solve your problem.

    Comment


    • #3
      Thanks Beagle! It works now. I didn't saw the woods for the trees

      Comment

      Working...
      X