没有解决方法吗,可客户就这么要求,咋办?

解决方案 »

  1.   

    很简单啊,[event]onmouseout事件
      

  2.   

    文本框的onmouseout事件上实现你要功能的代码
      

  3.   

    我困惑的地方就在这里,
    onmouseout是客户端事件而不是服务器端事件啊!我要在这个事件里到服务器中取数据,怎么做,在javascript里怎么能实现到数据库中取值呢?!
      

  4.   

    在onmouseout事件中,提交表单,在后台处理就可以了。或者,使用xmlhttp实现从服务器端取数据,也可以。
      

  5.   

    http://community.csdn.net/Expert/topic/3157/3157124.xml?temp=.4658014
      

  6.   

    onblur 
    使用msxml2技术应该能满足你的要求
      

  7.   

    试试  
    给页面上放个LinkButton Text为"";
    在该LinkButton的点击事件内
    写代码
    YourTextBox.Text="ABCDE";
    前台在你的TextBox的onblur中写
    onblur="__doPostBack('YourLinkButtonId,'')"
      

  8.   

    以下代码我通过测试
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> 客户端通过__doPostBack调用服务器端代码 </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="活靶子">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <script language="c#" runat=server>
    void Page_Load(object o,EventArgs e)
    {
    this.txt1.Attributes["onblur"] = "__doPostBack('lkb','')";
    }
    void Lkb_Click(object o ,EventArgs e)
    {
    //你可以在这里写你从数据库去数据赋给TextBox的代码
    this.txt2.Text="Welcome to www.AspxBoy.Com";
    }
    </script>
    </HEAD><BODY>
    <form runat=server>
    <asp:TextBox id="txt1" runat="server" />
    <br>
    <asp:TextBox id="txt2" runat="server"  width=200px/>
    <asp:LinkButton id="lkb" Text="" runat="server" OnClick="Lkb_Click"/></form></BODY>
    </HTML>
      

  9.   

    也可以换一个方法在
    Page_Load的时候把值取出来放入一个隐藏域 type=hidden的input中
    当TextBox onblur的时候把这个值取出 赋给你的Textbox 这样看上去 比较象客户端操作
    不用回发
      

  10.   

    xiahouwen(活靶子.NET) 你真是太酷了使用xmlhttp实现从服务器端取数据是怎样一种方式呢?
      

  11.   

    这是一个xmlhttp取网页代码的例子,可以请求xml,希望可以帮你,可以请求webservice,返回来xml,在利用DOM,查值赋给你要展现的控件就可以了<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style>
    body
    {
    font-family: Verdana;
    font-size: 12px;
    }</style><script>
    function viewSource(flag)
    {
    var XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    if (typeof(flag) == "undefined")
    {
    XmlHttp.Open("GET", document.location.href, false);
    XmlHttp.setRequestHeader("Content-Type", "text/XML");
    XmlHttp.Send();
    }
    else
    {
    var strHref = document.getElementById("txtHref").value;
    XmlHttp.Open("GET", strHref, false);
    XmlHttp.setRequestHeader("Content-Type", "text/XML");

    XmlHttp.Send();
    }

    var html = XmlHttp.responseText;

    document.getElementById("txtArea").value = html;

    }
    </script>
    </head><body>
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td>XMLHTTP</td>
    <td><input type="text" id="txtHref" value="http://"></td>
    <td><button onclick="viewSource()">查看本页源代码</button></td>
    <td><button onclick="viewSource(1)">查看其他网页源代码</button></td>
    </tr>
    </table>
    <textarea id="txtArea" style="width:100%;height:100%;font-family: Verdana"></textarea>
    </body>
    </html>