Click here to Skip to main content
13,045,019 members (44,933 online)
Click here to Skip to main content

Stats

75.9K views
46 bookmarked
Posted 13 Oct 2006

Restricting input by MaskEdit in IE / Firefox

, 5 Nov 2006
To provide a better user experience using MaskEdit, a textbox with restrictions, auot-trim box, and tip box, supports IE/Firefox.


function OnPageLoad()
{    
    InitializeTrimBox();    
    
    InitializeTextbox( "txtAcceptNonnegativeIntegerBox", InputType.NonnegativeInteger);
    InitializeTextbox( "txtAcceptWholeNumberBox", InputType.WholeNumber);
    InitializeTextbox( "txtAcceptCurrencyBox", InputType.Currency);
        
    InitializeMaskEdit( "txtPostalCode", "$A$d$A $d$A$d");
	InitializeMaskEdit( "txtTelPhone", "($d$d$d)$d$d$d-$d$d$d$d");
	InitializeMaskEdit( "txtCarNumber", "$$A*$d$d$d$d$d");
	InitializeMaskEdit( "txtDateTime1", "$d$d$d$d-$d$d-$d$d");
	InitializeMaskEdit( "txtDateTime2", "$d$d/$d$d/$d$d$d$d");
	
	InitializeTipBox( "txtTipBox", "If you do not change the password, left blank.");
}



// the first parameter is the XmlHttp parameter
// the sencond parameter is the custom parameter
function CallbackFunction(ajax)
{
    var objDoc = ajax.GetXmlDoc();
    //alert(objDoc.childNodes[0].nodeName );
    alert(ajax.GetResponse());
    //alert(ajax.GetCustomParam());
    
    //alert( objDom.selectSingleNode( "//xmlRoot/a" ).text );
   
    //alert(xmlHttp.responseText);
    //alert(xmlHttp.responseXML.xml);
    //alert(xmlHttp.status);
    //alert(xmlHttp.statusText);
    
    
}


function TestAjax()
{
    var ajax = new AJAX( GetAbsoluteUrl(".\\test.xml") );
    ajax.SetCallbackFun(CallbackFunction);
    ajax.SetCustomParam("Customer Parameter");
    ajax.AddUrlParameter( "Type", 1);
    ajax.AddUrlParameter( "Name", "Jerry");
    ajax.AddUrlParameter( "Card", "@#@@#=");
    ajax.Send(null);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jerry.Wang
Team Leader
China China
Jerry is from China. He was captivated by computer programming since 13 years old when first time played with Q-Basic.



  • Windows / Linux & C++

  • iOS & Obj-C

  • .Net & C#

  • Flex/Flash & ActionScript

  • HTML / CSS / Javascript

  • Gaming Server programming / video, audio processing / image & graphics



Contact: vcer(at)qq.com
Chinese Blog: http://blog.csdn.net/wangjia184

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 6 Nov 2006
Article Copyright 2006 by Jerry.Wang
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid