function "kal" and "getsign" not functioning.

    function kal (ta) {
    var xy;
    var x1 ; 
    var x2; 
    var x3; 
    var x4;
           if (xy==1) {x1=0; x2=1; x3=1; x4=1;}
    else if  (xy==2) {x1=1; x2=0; x3=1; x4=0;}
    else if  (xy==3) {x1=0; x2=1; x3=0; x4=1;}
    else if  (xy==4) {x1=1; x2=1; x3=1; x4=1;}
    else if  (xy==5) {x1=0; x2=0; x3=1; x4=0;}
    else if  (xy==6) {x1=0; x2=1; x3=1; x4=0;}
    else if  (xy==7) {x1=1; x2=1; x3=1; x4=0;}
    else if  (xy==8) {x1=1; x2=0; x3=1; x4=1;}
    else if  (xy==9) {x1=1; x2=1; x3=0; x4=1;}
    else if  (xy==10) {x1=0; x2=0; x3=1; x4=1;}
    else if  (xy==11) {x1=1; x2=1; x3=0; x4=0;}
    else if  (xy==12) {x1=0; x2=0; x3=0; x4=1;}
    else if  (xy==13) {x1=0; x2=1; x3=0; x4=0;}
    else if  (xy==14) {x1=1; x2=0; x3=0; x4=0;}
    else if  (xy==15) {x1=1; x2=0; x3=0; x4=1;}
    else if  (xy==16) {x1=0; x2=0; x3=0; x4=0;}
    this.xa = x1;
    this.xb = x2;
    this.xc = x3;
    this.xd = x4;
    return this;
    }
    xaxa = kal(as)
    w1 = xaxa.xa

    xbxb =kal(bs)
    w2 =xbxb.xa

    xcxc =kal(cs)
    w3 = xcxc.xa

    xdxd = kal(ds)
    w4 = xdxd.xa

      function getsign(w1, w2, w3, w4) {
      var sa;
      var w1;
      var w2;
      var w3;
      var w4;
       if  (w1==0 && w2==1 && w3==1 && w4==1) {sa = 1};
      if  (w1==1 && w2==0 && w3==1 && w4==0) {sa = 2};
      if  (w1==0 && w2==1 && w3==0 && w4==1) {sa = 3};
      if  (w1==1 && w2==1 && w3==1 && w4==1) {sa = 4};
      if  (w1==0 && w2==0 && w3==1 && w4==0) {sa = 5};
      if  (w1==0 && w2==1 && w3==1 && w4==0) {sa = 6};
      if  (w1==1 && w2==1 && w3==1 && w4==0) {sa = 7};
      if  (w1==1 && w2==0 && w3==1 && w4==1) {sa = 8};
      if  (w1==1 && w2==1 && w3==0 && w4==1) {sa = 9};
      if  (w1==0 && w2==0 && w3==1 && w4==1) {sa = 10};
      if  (w1==1 && w2==1 && w3==0 && w4==0) {sa = 11};
      if  (w1==0 && w2==0 && w3==0 && w4==1) {sa = 12};
      if  (w1==0 && w2==1 && w3==0 && w4==0) {sa = 13};
      if  (w1==1 && w2==0 && w3==0 && w4==0) {sa = 14};
      if  (w1==1 && w2==0 && w3==0 && w4==1) {sa = 15};
     if   (w1==0 && w2==0 && w3==0 && w4==0) {sa = 16};
     return sa;
     }
    sign = getsign(w1, w2, w3, w4)

function kal (ta) {
var xy;
var x1 ; 
var x2; 
var x3; 
var x4;
       if (xy==1) {x1=0; x2=1; x3=1; x4=1;}
else if  (xy==2) {x1=1; x2=0; x3=1; x4=0;}
else if  (xy==3) {x1=0; x2=1; x3=0; x4=1;}
else if  (xy==4) {x1=1; x2=1; x3=1; x4=1;}
else if  (xy==5) {x1=0; x2=0; x3=1; x4=0;}
else if  (xy==6) {x1=0; x2=1; x3=1; x4=0;}
else if  (xy==7) {x1=1; x2=1; x3=1; x4=0;}
else if  (xy==8) {x1=1; x2=0; x3=1; x4=1;}
else if  (xy==9) {x1=1; x2=1; x3=0; x4=1;}
else if  (xy==10) {x1=0; x2=0; x3=1; x4=1;}
else if  (xy==11) {x1=1; x2=1; x3=0; x4=0;}
else if  (xy==12) {x1=0; x2=0; x3=0; x4=1;}
else if  (xy==13) {x1=0; x2=1; x3=0; x4=0;}
else if  (xy==14) {x1=1; x2=0; x3=0; x4=0;}
else if  (xy==15) {x1=1; x2=0; x3=0; x4=1;}
else if  (xy==16) {x1=0; x2=0; x3=0; x4=0;}
this.xa = x1;
this.xb = x2;
this.xc = x3;
this.xd = x4;
return this;
}
xaxa = kal(as)
w1 = xaxa.xa

xbxb =kal(bs)
w2 =xbxb.xa

xcxc =kal(cs)
w3 = xcxc.xa

xdxd = kal(ds)
w4 = xdxd.xa

  function getsign(w1, w2, w3, w4) {
  var sa;
  var w1;
  var w2;
  var w3;
  var w4;
   if  (w1==0 && w2==1 && w3==1 && w4==1) {sa = 1};
  if  (w1==1 && w2==0 && w3==1 && w4==0) {sa = 2};
  if  (w1==0 && w2==1 && w3==0 && w4==1) {sa = 3};
  if  (w1==1 && w2==1 && w3==1 && w4==1) {sa = 4};
  if  (w1==0 && w2==0 && w3==1 && w4==0) {sa = 5};
  if  (w1==0 && w2==1 && w3==1 && w4==0) {sa = 6};
  if  (w1==1 && w2==1 && w3==1 && w4==0) {sa = 7};
  if  (w1==1 && w2==0 && w3==1 && w4==1) {sa = 8};
  if  (w1==1 && w2==1 && w3==0 && w4==1) {sa = 9};
  if  (w1==0 && w2==0 && w3==1 && w4==1) {sa = 10};
  if  (w1==1 && w2==1 && w3==0 && w4==0) {sa = 11};
  if  (w1==0 && w2==0 && w3==0 && w4==1) {sa = 12};
  if  (w1==0 && w2==1 && w3==0 && w4==0) {sa = 13};
  if  (w1==1 && w2==0 && w3==0 && w4==0) {sa = 14};
  if  (w1==1 && w2==0 && w3==0 && w4==1) {sa = 15};
 if   (w1==0 && w2==0 && w3==0 && w4==0) {sa = 16};
 return sa;
 }
sign = getsign(w1, w2, w3, w4)

Look to the console: "as" is not defined (line 29 and 95), function in parameter "ta" not used inside function.

Why you do not use a switch? It would be more convenient here:

function kal(ta){
    var xy=ta,x1,x2,x3,x4;
    switch(xy){
        case 1: x1=0; x2=1; x3=1; x4=1; break;
        case 2: x1=1; x2=0; x3=1; x4=0; break;
        case 3: x1=0; x2=1; x3=0; x4=1; break;
        case 4: x1=1; x2=1; x3=1; x4=1; break;
        case 5: x1=0; x2=0; x3=1; x4=0; break;
        case 6: x1=0; x2=1; x3=1; x4=0; break;
        case 7: x1=1; x2=1; x3=1; x4=0; break;
        case 8: x1=1; x2=0; x3=1; x4=1; break;
        case 9: x1=1; x2=1; x3=0; x4=1; break;
        case 10: x1=0; x2=0; x3=1; x4=1; break;
        case 11: x1=1; x2=1; x3=0; x4=0; break;
        case 12: x1=0; x2=0; x3=0; x4=1; break;
        case 13: x1=0; x2=1; x3=0; x4=0; break;
        case 14: x1=1; x2=0; x3=0; x4=0; break;
        case 15: x1=1; x2=0; x3=0; x4=1; break;
        case 16: x1=0; x2=0; x3=0; x4=0; break;
    }
    this.xa = x1;
    this.xb = x2;
    this.xc = x3;
    this.xd = x4;
    return this;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.