Alert is showing two times. how to restrict?

Posted by Dev on Stack Overflow See other posts from Stack Overflow or by Dev
Published on 2010-05-17T04:43:47Z Indexed on 2010/05/17 4:50 UTC
Read the original article Hit count: 173

function test(myObject, flag) { if ( (flag) || ((event.keyCode == 59) || (event.which == 59)) || ((event.keyCode == 44) || (event.which == 44))) {alert(myObject.value);} } function closeWin() {self.close();}

--foaram name='test'>
--textaarea name='textareaName' cols='44' rows='3' onChange='test(this, true);' --onKeyPress='test(this);' onBlur='test(this, true);' >
---inpaut type='text' name='textName'>
--inpaut type='button' name='buttonName' onclick='closeWin();' value='Cancel'> --/foarm>

I have a problem: when input value(e.g: test;) into textareaName field, the test function is always run more one time. Please show me the way can run this only one time.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events