Page 1 of 1

Display message without alert..

Posted: Mon Feb 21, 2011 12:28 am
by Gopesh
Hai,
i am developing a form in which i want to validate user input,am using onblur event .i want to display a validated message in a div on the same page without using alert.
pls help me to acheive this?

Re: Display message without alert..

Posted: Mon Feb 21, 2011 3:23 am
by Apollo
you probably want to adjust the div's innerHTML:

Code: Select all

<html><body><script type='text/javascript'>
function check(f)
{
  document.getElementById('bar').innerHTML = RegExp(/[^0-9]/).test(f.value) ? 'Numbers only please!' : 'OK';
}
</script><form>
<input name='foo' onblur='check(this)'><div id='bar'></div>
</form></body></html>

Re: Display message without alert..

Posted: Mon Feb 21, 2011 6:33 am
by Gopesh
thanks Apollo.it works fine,problem is solved..