Skip to content Skip to sidebar Skip to footer

What's Wrong In This Javascript Code?

I can't figure it out.. Markup:

&

Solution 1:

I have to agree with comments above, not sure what you're doing but...the problem is that a submit handler is a function not the string you're assigning, this:

subBut.onclick = (document.getElementById('helllo').innerHTML=(submi(document.getElementById('user').value, document.getElementById('passw').value)));

should be:

subBut.onclick = function() { 
  document.getElementById('helllo').innerHTML=
    submi(document.getElementById('user').value, document.getElementById('passw').value);
  returnfalse; //for testing, prevent form submission
}; 

You can test the updated version here.

Post a Comment for "What's Wrong In This Javascript Code?"