Beruflich Dokumente
Kultur Dokumente
Interfaces are a convenient way to define standard behaviors that other types can
implement .
An interface is a contract that states that the implementer of the interface must
provide all of the functionality specified in the interface.
The interface itself is only a specification and has no functionality of its own
Interface definitions follow the same pattern as creating classes
The function name is the name of the interface. The prototype of the function is
modified to add the interface members.
The convention in defining interface members is to throw Error.notImplemented for
each member, so any class that implements the interface then needs to override
the interface members to provide real implementations or the exception will be
thrown.
alert(Wrox.ASPAJAX.Samples.MusicGenre.toString(ge
nre));
alert(genre ==
Wrox.ASPAJAX.Samples.MusicGenre.Industrial);
Microsoft ASP.NET AJAX provides features that helps in creating client script and
integrate it into ASP.NET applications. This includes extensions to existing
ECMAScript (JavaScript) objects to give them the richness of .NET Framework
classes
The AJAX Library takes a familiar set of features from the Base Class Library of
the .NET Framework and brings it to JavaScript in the browser
Extensions to JavaScript base types provide additional functionality for these types.
XMLHttpRequest Object
Remote Scripting:
To minimize the impact of page redraws, primitive forms of scripted remote
procedure calls (RPC) appeared around 1997. Microsoft, in particular,
pioneered this field with a technology called Remote Scripting (RS).
RS employed a Java applet to pull in data from a remote Active Server Pages
(ASP)-based URL. The URL exposed a contracted programming interface
through a target ASP page and serialized data back and forth through plain
strings. On the client, a little JavaScript framework received data and
invoked a user-defined callback to update the user interface via Dynamic
HTML or similar techniques. RS worked on both Internet Explorer 4.0 and
Netscape Navigator 4.0 and older versions.
XMLHttpRequest Object
XMLHttpRequest Object
XMLHttpRequest Object
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server
ID="ScriptManager1">
</asp:ScriptManager>
</form>
</body>
</html>
(CallTime.aspx) shows basic usage of the
XMLHttpRequest object to call the time
web page
Data Communications
When tied together with web services, XML and JSON allow for data
interchange between different operating systems and also across
the Internet.
<body>
<form id="Form1" runat="server">
<asp:ScriptManager runat="server"
ID="scriptManager">
<Services>
<asp:ServiceReference
path="ServerTime.asmx" />
</Services>
</asp:ScriptManager>
<div>
<h2>Server Time</h2>
<p>Calling a service that returns the
current server time.</p>
<input id="EchoButton" type="button"
value="GetTime"
onclick="GetServerTime()" />
</div>
</form>
<hr/>
<div>
<span id="Results"></span>
</div>
</body>
</html>