验证文本框是否为空弹出提示
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="jquery-2.1.0-beta3.js"></script>
<script>
$(function () {
$("#tbn").click(function () {
var txt = $("#txt");
if (txt.val().length==0) {
alert("ok");
} else {
alert("no");
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" name="name" id="txt" />
<input type="button" name="btn" value="确定" id="tbn" />
</div>
</form>
</body>
</html>