function check_ip_format( field, container ) {
var nodes=null, limit, result='',i=-1;
container=container?container.toUpperCase():null;
if(container)
{
while( field.nodeName.toUpperCase()!=container )
{
field=field.parentNode;
}
nodes=field.getElementsByTagName('input');
}
else
{
nodes=[field];
}
limit=nodes.length;
while(++i<limit)
{
//validate only TEXT fields whose name start with "IP"
if(nodes[i].type && nodes[i].type.toUpperCase()=="TEXT" && nodes[i].name.substring(0,2)=='IP')
{
result+=("ip_field=>>" + nodes[i].name + "<<\n");
result+=("ip_value=>>" + nodes[i].value + "<<\n");
if (!isBlank(nodes[i].value)){
result+=( ( ipRE.test( nodes[i].value ) ? '' : 'in' ) + 'valid' )+"\n\n";
if ( !ipRE.test( nodes[i].value ) )
nodes[i].focus();
}
}
}
alert( result );
}
Alert command behave strange in the script flow.
and try to remove the "return" part in ur onblur attributes: it's not needed IMO