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


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()
    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( objDom.selectSingleNode( "//xmlRoot/a" ).text );

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

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.


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


About the Author

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)
Chinese Blog:

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