SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 85 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"

The last statement in the code shows how to use the
registerClass method to register the SUV class in the AJAXBook namespace. The first
parameter in the registerClass method, AJAXBook.SUV, specifies the fully qualified name
of the new class. The second parameter in the registerClass method, AJAXBook.Car, specifies
the base class. In other words, AJAXBook.SUV inherits from AJAXBook.Car.
To see the AJAXBook.SUV class in action, return to the web page you created earlier,
and change the Button1_onclick script to match the following code:
function Button1_onclick()
{
var testCar = new AJAXBook.Car('Honda','Pilot','2005');
alert(testCar.get_MakeandModel());
alert(testCar.get_Year());
var testSUV = new AJAXBook.SUV('Honda','Pilot','2005','Active');
alert("SUV Make and Model: " + testSUV.get_MakeandModel());
alert(testSUV.get_Year());
CHAPTER 3 ?–  THE MICROSOFT AJAX LIBRARY: MAKING CLIENT-SIDE JAVASCRIPT EASIER 44
alert(testSUV.get_DriveType());
return false;
}
We??™ve added the creation of an instance of the class AJAXBook.SUV and invoked its
methods get_MakeandModel, get_Year, and get_DriveType.


Pages:
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97