<html>
<body>
<script language="javas
function calculate()
{
//正则[^a]字符a是你需要统计的字符
document.all.result.value=document.all.uInput.value.replace(/[^a]/g, '').length;
}
</script>
请输入<input name="uInput" type="text">
<input type="button" value="计算" on
结果为<input name="result" type="text">
</body>
</html>
评论