jeudi 26 mai 2016

does onblur support multiple if else statements?

<html>
<body>
    <input type="text" value="0"    id="x1" onblur="ThisEvent()"/>x1</br>               
    <input type="text" value="0"    id="x2">x2      </br>

<script>
    var x1      = document.getElementById("x1");    
    var x2      = document.getElementById("x2");

function ThisEvent(){
    if (x1=1)   {x2.value--;}else{
    if (x1=2)   {x2.value++;}else{
    if (x1=3)   {x2.value+0;}}}
    }
</script>
</body>
</html>

seems to only fire the first if statement and ignore the else situation. any help would greatly be appreciated

Aucun commentaire:

Enregistrer un commentaire