判断text是否有输入,没有弹出警告并停止页面的运行.要怎么做,求高手指导~~
ass.js
function form1_onsubmit()
{
var text1= document.all("TextBox1").value;
if(text1=="")
{
alert("值不能为空");
return false;
}
}
-----------------------------------------------------
ass.cs
protected void Page_Load()
{
int text1 = int.Parse(TextBox1.Text);
int y=text1+1;
}
-----------------------------------------
上面js代码并不能阻止网页的运行,仅仅能够显示一次"值不能为空",要怎么改才能
立刻阻止网页的运行那?
ass.js
function form1_onsubmit()
{
var text1= document.all("TextBox1").value;
if(text1=="")
{
alert("值不能为空");
return false;
}
}
-----------------------------------------------------
ass.cs
protected void Page_Load()
{
int text1 = int.Parse(TextBox1.Text);
int y=text1+1;
}
-----------------------------------------
上面js代码并不能阻止网页的运行,仅仅能够显示一次"值不能为空",要怎么改才能
立刻阻止网页的运行那?
{
Button1.Attributes.Add("onclick", "form1_onsubmit();");
int text1 = int.Parse(TextBox1.Text);
int y=text1+1;
}
----------------------------------
您说的对,但怎样阻止网页运行那?我不知道怎么使用返回的false.请多指教!
你要在Button_Onclick里事件里判断,
你好好想想程序的执行顺序是什么