62,046
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script language="javascript">
function check(){
if((document.getElementById('one').value=="")^(document.getElementById('two').value=="")){
alert('false');
}else
{
alert('true');
}
}
</script>
</head>
<body>
<input type="text" id="one"/>
<input type="text" id="two"/>
<input type="button" onclick="check()" />
</body>
</html>
function check()
{
var tb1 = document.getElementById("<%= TextBox1.ClientID %>");
var tb2 = document.getElementById("<%= TextBox2.ClientID %>");
if(tb1.value != "")
{
if(tb2.value == "")
{
alert("tb2不能为空");
return false;
}
return true;
}
else
{
if(tb2.value != "")
{
alert("tb1不能为空");
return false;
}
return true;
}
}
function checkNull()
{
var t1=document.getElementById("textbox1");
var t2=document.getElementById("textbox2");
if(t1.value==""&&t2.value=="")
{
alert('不能空');
return false;
}
}