Click here to Skip to main content
15,886,110 members
Articles / Web Development / HTML

Writing Object-Oriented JavaScript Part 2

Rate me:
Please Sign up or sign in to vote.
4.37/5 (22 votes)
8 Dec 20038 min read 113K   1.1K   58  
Using Cfx to develop a JavaScript control class library.
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Inheritance.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>WebForm1</title>
		<script language="JavaScript" src="scripts/Cfx.js" type="text/javascript"></script>
		<script language="JavaScript" src="scripts/Validator.js" type="text/javascript"></script>
		<script language="JavaScript" src="scripts/TextValidator.js" type="text/javascript"></script>
		<script language="JavaScript" src="scripts/WildcardValidator.js" type="text/javascript"></script>
		<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<script type="text/javascript">
function OnLoad() 
{
	alert( "in OnLoad" );
	var valText1 = new WildcardValidator( "TextBox1" );
	valText1.Enable( true );
	alert( valText1.FieldName() );
	alert( valText1.className + " instance of Validator = " + valText1.InstanceOf( Validator ) );
		
	var valText2 = new TextValidator( "TextBox2" );
	valText2.Enable( false );
	alert( valText2.FieldName() );
	alert( "\"" + valText2.Value() + "\"" );
	alert( "\"" + valText2.Value().trim() + "\"" );

	var valText3 = new TextValidator( "TextBox3" );
	alert( valText3.FieldName() );
	valText3.Value( valText2.Value().trim() );
	valText3.SetFocus();
}
		</script>
	</HEAD>
	<body onload="OnLoad();" MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<asp:label id="Label0" style="Z-INDEX: 101; LEFT: 54px; POSITION: absolute; TOP: 40px" runat="server" Width="147px">Class Inheritance Demo</asp:label>
			<asp:textbox id="TextBox1" style="Z-INDEX: 102; LEFT: 278px; POSITION: absolute; TOP: 107px" runat="server">SSDSDS</asp:textbox>
			<asp:textbox id="TextBox2" style="Z-INDEX: 103; LEFT: 276px; POSITION: absolute; TOP: 165px" runat="server">   MMMMMM   </asp:textbox>
			<asp:textbox id="TextBox3" style="Z-INDEX: 104; LEFT: 279px; POSITION: absolute; TOP: 230px" runat="server"></asp:textbox>
			<asp:label id="Label1" style="Z-INDEX: 105; LEFT: 80px; POSITION: absolute; TOP: 106px" runat="server" Width="147px"> WildcardValidator</asp:label>
			<asp:label id="Label2" style="Z-INDEX: 106; LEFT: 78px; POSITION: absolute; TOP: 164px" runat="server" Width="147px"> TextValidator</asp:label>
			<asp:label id="Label3" style="Z-INDEX: 107; LEFT: 77px; POSITION: absolute; TOP: 231px" runat="server" Width="147px"> TextValidator</asp:label></form>
	</body>
</HTML>

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions