Use the Regular expression with a java script like below.
function validate()
{
var ex = /^[0-9]{5}$/;
if(ex.test(document.getElementById('textBoxId').value) == false)
{
}
}
Call this function on onblur evenr of the text box.
<input type="text" id="textBoxId" onblur="validate();" />
BR//
Harsha