Đang chuẩn bị liên kết để tải về tài liệu:
Beginning Ajax with ASP.NET- P4
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Beginning Ajax with ASP.NET- P4:Thank you for purchasing Beginning Ajax with ASP.NET. We know that you have a lot of options when selecting a programming book and are glad that you have chosen ours. We’re sure you will be pleased with the relevant content and high quality you have come to expect from the Wrox Press line of books. | Introduction to DHTML var isArrowLeft true function ChangeMe target isArrowLeft isArrowLeft if isArrowLeft target.src images ArrowLeft.gif else target.src images ArrowRight.gif After rendering the page the isArrowLeft variable is initially set to true. And when the image is clicked the ChangeMe function is called with the image object being passed in. Within that function the image object is called as target. The isArrowLeft variable which holds a boolean value is set to its opposite with the first statement. Then that target image s src attribute is set based on what the isArrowLeft value holds. A similar example to this is found at the start of Chapter 7 but it goes further to include more intricate string manipulation with the split function and referencing an array member. It also uses the prototype keyword to add a method called substituted to all strings. This more in-depth example will make better sense after you digest the next chapter which has information about objects and more about functions. Programmatically Populating the Options in select When a choice is made in one drop-down list it is often handy to populate a second drop-down list with appropriate choices. With Ajax this is fairly straightforward and this sample will show you how to implement the JavaScript side of things dynamically adding new option objects to the contents of a drop-down list. The select element is what builds a drop-down list or a list box if the size attribute has been set . This next Try It Out has you build a drop-down list by using select and then add a textbox and button underneath. When you type some text and click the button it will build a new option in the drop-down list. Finding Objects with document.getElementById Before you go further you need to know about an important tool at your disposal. In the last section you worked with an image object by using the special this keyword available inside an event handler. It was convenient but what if you wanted to find an .