hi,
I have a textbox and i want to see the user has a value entered in it
If he doesnt enter a number value then fire a alert
so right now I am checking that he doesnt press the space bar and have a empty space
here is my code.
But its not working
Code:if(trim(document.frm1.txtnumber.value) { alert("enter a value"); } function Trim(s) { // Remove leading spaces and carriage returns while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')) { s = s.substring(1,s.length); } // Remove trailing spaces and carriage returns while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')) { s = s.substring(0,s.length-1); } return s; }



LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks