
asp.net设置了textbox如果为空就弹出提示,但为什么现在为空了还是没有任何提示呢
if(TextBox1.Text==""||TextBox2.Text==""){Response.Write(@"<script>alert('输入内容不允许为空');...
if (TextBox1.Text == "" || TextBox2.Text == "")
{
Response.Write(@"<script>alert('输入内容不允许为空');</script>");
}
else
{
他就会直接执行else了,不太理解为什么。我看到有人说是因为空字符串才会这样。那应该怎么解决呢 展开
{
Response.Write(@"<script>alert('输入内容不允许为空');</script>");
}
else
{
他就会直接执行else了,不太理解为什么。我看到有人说是因为空字符串才会这样。那应该怎么解决呢 展开
展开全部
测试下TextBox1.Text的类型,直接输出下
试着TextBox1.Text.value
TextBox1.value
js的话我是这样写的
var pValue = document.getElementById("password").value;
if(pValue==""){
alert("输入内容不允许为空");
return false;
}
试着TextBox1.Text.value
TextBox1.value
js的话我是这样写的
var pValue = document.getElementById("password").value;
if(pValue==""){
alert("输入内容不允许为空");
return false;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询