注册 登录
编程论坛 ASP.NET技术论坛

还是脚本问题。。。

人妖123 发布于 2007-11-26 13:19, 698 次点击
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AddCase1.aspx.cs" Inherits="_Default" Title="999" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript">
function check()
{
   if(document.getElementById('TextBox2').value=="")
   {
      alert('不能为空,请重新查询');
      
   }
   else
   {
    alert('8888888888');
   }
}
</script>
。。。。。。。。。。
</asp:Content>
我在page_lode里面调用:

this.Button1.Attributes.Add("onclick", "check()");

就是触发不了啊,到底在内容页面里面怎么写javascript函数啊。。。。。。。。。
5 回复
#2
人妖1232007-11-26 13:21
我在一般的页面里测试都可以,但就是到了包含模板页里面的内容页里面写就出问题了。
#3
bygg2007-11-26 14:52
function check()
{
  var txtValue = document.getElementById('TextBox2').value;   
  if(txtValue =="" || txtValue == null)
   {
      alert('不能为空,请重新查询');      
   }
   else
   {
    alert('8888888888');
   }
}
#4
人妖1232007-11-26 14:57
哥哥呢 我们写的一样啊。。。。。

我想还是母版页和内容页的问题呐。。你帮我看看。。。。。
主要看check这个函数写在哪里才合适。。。。。
#5
bygg2007-11-26 15:03
随便写到哪里都行啊,只要能访问到。
#6
人妖1232007-11-26 16:09
哎,无奈。
1