<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
function demo(){
try{
alert(str);
}catch(e){
alert(e);
}
}
demo();
</script>
<form>
<input id="txt" type="text"/>
<input id="btn" type="button" onclick="demo1()" value="按钮" />
</form>
<script>
function demo1(){
try{
var e=document.getElementById("txt").value;
if(e==""){
throw "请输入";
}
}catch(e){
alert(e);
}
}
</script>
</body>
</html>

被折叠的 条评论
为什么被折叠?



