<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var a = +prompt('请输入圆的半径:');
var dec1 = "数据输入格式错误,请重新输入!"
var dec2 = "数据类型符合要求,点击确定计算结果。"
var flag = isNaN(a) ? dec1 : dec2
alert(flag);
var r = a * 1;
var c = 2 * r * Math.PI;
var s = r * r * Math.PI;
document.write("圆的周长:" + c.toFixed(2));
document.write("圆的面积:" + s.toFixed(2));
</script>
</body>
</html>