<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
function isEmpty(str){
if(str===undefined){
return true;
}else if(str==null){
return true;
}else{
var reg=/^\s*$/;
return reg.test(str);
}
}
while(true){
var input=prompt("输入");
if(!isEmpty(input)){
document.write(input);
break;
}else{
alert("输入不能为空")
}
}
</script>
</body>
</html>