Concerning the actual use of the ajax. dll Development Kit, the compatibility between IE6.0 and IE7.0 is involved.

Source: Internet
Author: User

Javascript code:

// Check whether the customer name exists

Method 1:
Function SearchCustName ()
{
Var name = escape (document. getElementById ("txt_Custname"). value );
Var a = Test. GetCustName (name). value;
Document. getElementById ("txtname"). innerText = a; // when using DIV, it is available in IE6.0 but not in IE7.0.
}

Method 2:

Function SearchCustName ()
{
Var name = escape (document. getElementById ("txt_Custname"). value );
Var a = Test. GetCustName (name). value;
Document. getElementById ("txtname"). value = a; // It is available in IE7.0 and IE6.0 when DIV is used.

}

Add_Customer.aspx code

When method 1 is used:

Customer name: <input id = "txt_Custname" runat = "server" onchange = "SearchCustName ()" type = "text"/>

<Span style = "color: # ff0000"> * </span> <div id = "txtname"> </div> <span style = "color: # ff0000 "> </span> </td>

When method 2 is used:

Customer name: <input id = "txt_Custname" runat = "server" onchange = "SearchCustName ()" type = "text"/>

<Span style = "color: # ff0000"> * </span>: <input id = "txtname" type = "text"/>

Test. cs code:

[Ajax. AjaxMethod ()]
Public string GetCustName (string Custname)
{
String SQL = "select * from MERs where cust_name = '" + custname + "'";
Sqldatareader DR = Co. getdatareader (SQL );
If (dr. Read ())
{
Return "prompt: this user already exists. Please enter it again! ";
}
Else
{
Return "";
}
}

As this talent started to learn Ajax and has limited familiarity with JavaScript, please kindly advise me. Thank you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.