问题在于接受一个或多个港口,它们之间有一席之地。
with help of friends here, I used this one for my answer but for example if I enter 88888 it will alert me such this thing:
88888NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN is not correct
我如何纠正这种情况
<script type="text/javascript">
function portvalidating(field)
{
var output= ;
m=field.value;
if(/^d{1,5}([ ]d{1,5})*$/.test(m))
{
var parts = m.split( );
for(i in parts)
{
var p= parseInt(parts[i]);
if(!((0 <= p) && (p<= 65535) && !isNaN(p)))
{
output+=p;
}
}
if(output== )
var dummy=1;
else alert(output+ is not correct );
}
else alert( please enter a valid port! );
}