Chương này khám phá thế giới đầy đủ và đa dạng của các mốc thời gian. Sau khi giới thiệu một phần mang đến cho bạn để tăng tốc độ trên cơ bản Đối với thông tin trực tuyến và đặt hàng này và các cuốn sách Manning khác | 1062 Part VII Extending Dreamweaver Note Whenever API functions require the DOM object such as the function and others discussed in the following sections you must first get the DOM of the current document. In all the examples that follow the variable theDOM is understood to have been established early on like this var theDOM document The function How a behavior performs is quite often dictated by what tag the user selects prior to attaching the behavior. The getSelection function is the first step toward getting all the information necessary to control your behavior based on a user selection. I emphasize first step because this function returns the selection in the form of byte offsets in memory. A byte offset is a number that points to a memory address. In the case of the getSelection function the two byte offsets that are returned mark the beginning and end of the selection in memory. For example you open a new page in Dreamweaver type in a phrase such as The Key Points and then select the first word The. If you used the getSelection function like this var selArray alert selArray the alert box would return 161 164 which denotes the beginning byte 161 and the ending byte 164 offset of the selected word The. If your beginning and ending byte offsets are the same as in 164 164 then nothing is selected. This fact comes in handy when you want to make sure that the user has selected something before proceeding. To examine what is contained within the byte offsets returned by the getSelection function you have to use the offsetsToNode function explained later in this section. The function Just as getSelection retrieves the memory offsets of the current selection the setSelection function sets a new pair of memory offsets and thus a new selection. The setSelection function takes two arguments offsetBegin and offsetEnd. setSelection is most often used to restore a user s .