javascript - Onclick attribute with if statement -
click1=document.getelementbyid("job1"); click2=document.getelementbyid("job2"); if (click1.onclick) { x=1; store(x); } else { x=2; store(x); }
why won't work , instead loads next function without clicking?
you can try instead:
click1=document.getelementbyid("job1"); click2=document.getelementbyid("job2"); click1.onclick= function() { x=1; store(x); } click2.onclick = function() { x=2; store(x); }
Comments
Post a Comment