<script>
function check(strpercent)
{
var re=/^(-|\+)?(\d+\.\d+)?%$/
var matcharr = strpercent.match(re);
if(matcharr == null)return false;
num = matcharr[2];
if(num>=0 && num<=100)return true;
else return false;
}
alert(check("100.5%"))
alert(check("10.5%"))
</script>
function check(strpercent)
{
var re=/^(-|\+)?(\d+\.\d+)?%$/
var matcharr = strpercent.match(re);
if(matcharr == null)return false;
num = matcharr[2];
if(num>=0 && num<=100)return true;
else return false;
}
alert(check("100.5%"))
alert(check("10.5%"))
</script>
function check(strpercent)
{
return /^(-|\+)?\d{1,2}(\.\d+)?%$/.test(strpercent);
}
alert(check("100.5%"))
alert(check("10.5%"))
</script>
function ispercent(source) {
return(/^(-|\+)?\d{1,2}(\.\d+)?|[100]%$/.test(source));
}