Archive for September, 2007

My web site - 159Chapter 15 .Generic HTML Element Objects unless your

Sunday, September 30th, 2007

159Chapter 15 .Generic HTML Element Objects unless your scripts immediately assign new attributes to the element, the appearance of the element reverts to its completely unadorned form until you assign new attributes. This means that even positioned elements find their way back to their source code order until you assign a new positioning style. If you simply want to change the value of one or more attributes of an element, it is faster to use the setAttribute() method or adjust the corresponding property. To accomplish a result in NN6 that simulates that of IE5 s clearAttributes(), you must iterate through all attributes of an element and remove those attributes (via the removeAttribute() method) whose names are other than ID and NAME. Example on the CD-ROM Related Items: attributes property; getAttribute(), setAttribute(), removeAttribute(), mergeAttributes(), and setAttributeNode() methods. click() Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The click() method lets a script perform nearly the same action as clicking an element. While this method was available in one form or another since the beginning of scripting, it was available only on INPUT elements that act as buttons (input type button, reset, submit, radio, and checkbox). Most element objects received the method in IE4 and NN6. The behavior of the click()method has also changed over time. Prior to NN4 and IE4, the click() method invoked on a button did not trigger the onClick event handler for the object. This has significant impact if you expect the onClick event handler of a button to function even if a script performs the click. For earlier browser versions, you have to invoke the event handler statements directly. Also, just because a script is clicking a button, not all buttons in all platforms change their appearance in response. For example, NN4 on the Mac does not change the state of a checkbox when clicked remotely. (Win32 versions of version 4 browsers do change state.) If you want to script the action of clicking a button, you can safely invoke the resulting event handler function directly. And if the element is a radio button or checkbox, handle the change of state directly (for example, set the checkedproperty of a checkbox) rather than expect the browser to take care of it for you. Example on the CD-ROM On the CD-ROM On the CD-ROM elementObject.click()
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

158 Part III (Web domain) .Document Objects Reference An unfortunate

Sunday, September 30th, 2007

158 Part III .Document Objects Reference An unfortunate side effect of button focus in Win32 environments is that the focus highlight (a dotted rectangle) remains around the button after a user clicks it and until another object gets focus. You can eliminate this artifact for browsers and objects that implement the onMouseUp event handler by including the following event handler in your buttons: onMouseUp = this.blur() IE5.5 recognizes the often undesirable effect of that dotted rectangle and lets scripts set the hideFocus property of an element to trueto keep that rectangle hidden while still giving the element focus. It is a tradeoff for the user, however, because there is no visual feedback about which element has focus. Other elements For other kinds of elements that support the focus() method, you can bring an element into view in lieu of the scrollIntoView() method. Link (A) and AREA elements in Windows versions of IE display the dotted rectangle around them after a user brings focus to them. To eliminate that artifact, use the same onMouseUp = this.blur() event handler as (or IE5.5 hideFocusproperty) just described for form controls. Microsoft increased the breadth of objects that support the blur()and focus() methods in IE5. Example (with Listing 15-23) on the CD-ROM Related Items: window.open(), document.formObject.textObject.select() methods. clearAttributes() Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The clearAttributes() method removes all attributes from an element except the NAME and IDvalues. Thus, styles and event handlers are removed, as are custom attributes assigned in either the HTML source code or later by script. You should know that the clearAttributes() method does not alter the length of the element s attributes collection because the collection always contains all possible attributes for an element. (See the attributes property for elements earlier in this chapter.) This method is handy if you wish to construct an entirely new set of attributes for an element and prefer to start out with a blank slate. Be aware, however, that On the CD-ROM elementObject.clearAttributes()
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

157Chapter 15 .Generic HTML Element Objects Form elements (Web server setup)

Sunday, September 30th, 2007

157Chapter 15 .Generic HTML Element Objects Form elements The blur() and focus()methods apply primarily to text-oriented form controls: text input, SELECT, and TEXTAREA elements. Just as a camera lens blurs when it goes out of focus, a text object blurs when it loses focus when someone clicks or tabs out of the field. Under script control, blur() deselects whatever may be selected in the field, and the text insertion pointer leaves the field. The pointer does not proceed to the next field in tabbing order, as it does if you perform a blur by tabbing out of the field manually. For a text object, having focus means that the text insertion pointer is flashing in that text object s field. Giving a field focus is like opening it up for human editing. Setting the focus of a text field or TEXTAREA does not, by itself, enable you to place the cursor at any specified location in the field. The cursor usually appears at the beginning of the text. To prepare a field for entry to remove the existing text, use both the focus() and select() methods in series. Be aware, however, that the focus() method does not work reliably in Navigator 3 for UNIX clients: While the select() method selects the text in the designated field, focus is not handed to the field. One other caveat about using focus()and select() together to preselect the content of a text field for immediate editing: Many versions of Internet Explorer fail to achieve the desired results due to an internal timing problem. You can work around this problem (and remain compatible with Navigator) by initiating the focus and selection actions through a setTimeout() method. See Chapter 43 on data validation for an example. A common design requirement is to position the insertion pointer at the end of a text field or TEXTAREA so that a user can begin appending text to existing content immediately. This is possible in IE4+ with the help of the TextRangeobject. The following script fragment moves the text insertion pointer to the end of a TEXTAREA element whose ID is myTextarea: var range = document.all.myTextarea.createTextRange() range.move( textedit ) range.select() You should be very careful in combining blur() or focus()methods with onBlur and onFocusevent handlers especially if the event handlers display alert boxes. Many combinations of these events and methods can cause an infinite loop in which it is impossible to dismiss the alert dialog box completely. On the other hand, there is a useful combination for older browsers that don t offer a disabled property for text boxes. The following text field event handler can prevent users from entering text in a text field: onFocus = this.blur() Some operating systems and browsers enable you to give focus to elements such as buttons (including radio and checkbox buttons) and hypertext links (encompassing both A and AREA elements). Typically, once such an element has focus, you can accomplish the equivalent of a mouse click on the element by pressing the spacebar on the keyboard. This is helpful for accessibility to those who have difficulty using a mouse. elementObject.blur()
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

156 Part III .Document Objects Reference Related Items: (Web design portfolio)

Saturday, September 29th, 2007

156 Part III .Document Objects Reference Related Items: addEventListener(), detachEvent(), dispatchEvent(), fireEvent(), removeEventListener() methods; Event binding (Chapter 14). blur() focus() Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The blur() method removes focus from an element, while the focus()method gives focus to an element. Even though the blur() and focus()methods have been around since the earliest scriptable browsers, not every focusable object has enjoyed these methods since the beginning. Browsers prior to IE4 and NN6 limited these methods primarily to the windowobject and form control elements. Windows For window objects, the blur()method (NN3+, IE4+) pushes the referenced window to the back of all other open windows. If other browser suite windows (such as e-mail or news reader windows) are open, the window receiving the blur() method is placed behind these windows as well. The window.blur() method does not adjust the stacking order of the current window in NN6. But a script in a window can invoke the focus() method of another window to bring that other window to the front (provided a scriptable linkage, such as the window.openerproperty, exists between the two windows). The minute you create another window for a user in your Web site environment, you must pay attention to window layer management. With browser windows so easily activated by the slightest mouse click, a user can lose a smaller window behind a larger one in a snap. Most inexperienced users don t think to check the Windows taskbar or browser menu bar (if the browser is so equipped) to see if a smaller window is still open and then activate it. If that subwindow is important to your site design, then you should present a button or other device in each window that enables users to safely switch among windows. The window.focus()method brings the referenced window to the front of all the windows. Rather than supply a separate button on your page to bring a hidden window forward, you should build your window-opening functions in such a way that if the window is already open, the function automatically brings that window forward (as shown in Listing 15-23). This removes the burden of window management from your visitors. The key to success with this method is making sure that your references to the desired windows are correct. Therefore, be prepared to use the window.opener property to refer to the main window if a subwindow needs to bring the main window back into focus. Caution elementObject.blur()
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Web server hosting - 155Chapter 15 .Generic HTML Element Objects Example (with

Saturday, September 29th, 2007

155Chapter 15 .Generic HTML Element Objects Example (with Listing 15-22) on the CD-ROM Related Items: insertBefore(), appendChild(), insertAdjacentElement() methods. attachEvent( eventName , functionRef) detachEvent( eventName , functionRef) Returns: Boolean. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The attachEvent() method is used primarily within code that specifies IE behaviors (see Chapter 48). But you can also use it in regular scripting as yet another way to bind an event handler to an object. The following example characterizes the more typical approach to assigning an event handler: myObject.onmousedown = setHilite The version with attachEvent() is as follows: myObject.attachEvent( onmousedown , setHilite) Both parameters are required. The first parameter is a string version (caseinsensitive) of the event name. The second is a reference to the function to be invoked when the event fires for this object. A function reference is an unquoted, case-sensitive identifier for the function without any parentheses (which also means that you cannot pass parameters in this function call). There is a subtle benefit to using attachEvent() over the event property binding approach. When you use attachEvent(), the method returns a Boolean value of true if the event binding succeeds. IE triggers a script error if the function reference fails, so don t rely on a returned value of falseto catch these kinds of errors. Also, there is no validation that the object recognizes the event name. If you have used attachEvent()to bind an event handler to an object s event, you can disconnect that binding with the detachEvent() method. The parameters are the same as for attachEvent(). The detachEvent() method cannot unbind events whose associations are established via tag attributes or event property settings. The W3C DOM event model provides functionality similar to these IE-only methods: addEventListener()and removeEventListener(). Example on the CD-ROM On the CD-ROM On the CD-ROM elementObject.attachEvent()
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

154 Part III .Document Objects Reference var newB (Web host forum)

Friday, September 28th, 2007

154 Part III .Document Objects Reference var newB = document.createElement( B ) newB.appendChild(document.createTextNode( Important! )) At this point, you can append or insert the newBelement. It appears with its content ready to go. The appendChild() method returns a reference to the appended node object. This reference differs from the object that is passed as the method s parameter because the returned value represents the object as part of the document rather than as a freestanding object in memory. Example (with Listing 15-21) on the CD-ROM Related Items: removeChild(), replaceChild() methods; nodes and children (Chapter 14). applyElement(elementObject[, type]) Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The applyElement() method (not implemented in IE5/Mac) enables you to insert a new element as the parent or child of the current object. An important feature of this method is that the new object is wrapped around the current object (if the new element is to become the parent) or the current object s content (if the new element is to become a child). When the new element becomes a child, all previous children are nested further by one generation to become immediate children of the new element. You can imagine how the resulting action of this method affects the containment hierarchy of the current element, so you must be careful in how you use the applyElement()method. One parameter, a reference to the object to be applied, is required. This object may be generated from constructions such as document.createElement() or from one of the child or node methods that returns an object. The second parameter is optional, and it must be one of the following values: Parameter Value Description outside New element becomes the parent of the current object inside New element becomes the immediate child of the current object If you omit the second parameter, the default value (outside) is assumed. On the CD-ROM elementObject.applyElement()
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

153Chapter 15 .Generic HTML Element (Web design tools) Objects A script

Friday, September 28th, 2007

153Chapter 15 .Generic HTML Element Objects A script can also eliminate an event listener that was previously added by script. The removeEventListener() method takes the same parameters as addEventListener(), which means that you can turn off one listener without disturbing others. In fact, because you can add two listeners for the same event and listener function (one set to capture and one not a rare occurrence, indeed), the three parameters of the removeEventListener()enable you to specify precisely which listener to remove from an object. Unlike the event capture mechanism of NN4, the W3C DOM event model does not have a global capture mechanism for an event type regardless of target. And with respect to IE5, the addEventListener() method is closely analogous to the IE5 attachEvent() method. Also, event capture in IE5 is enabled via the setCapture() method. Both the W3C and IE5 event models use their separate syntaxes to bind objects to event handling functions, so the actual functions may be capable of serving both models with browser version branching required only for event binding. See Chapter 29 for more about event handling with these two event models. Example (with Listing 15-20) on the CD-ROM Related Items: attachEvent(), detachEvent(), dispatchEvent(), fireEvent(), removeEventListener() methods. appendChild(nodeObject) Returns: Node object reference. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Using the W3C DOM parent, node, and child terminology, you can create cross- browser code (for IE5+ and NN6) that modifies HTML content on the page. The appendChild() method inserts an element or text node (defined by other code that comes before it) as the new, last child of the current element. Aside from the more obvious application of adding a new child element to the end of a sequence of child nodes, the appendChild() method is also practical for building element objects and their content before appending, replacing, or inserting the element into an existing document. The document.createElement()method generates a reference to an element of whatever tag name you assign as that method s parameter. But this does nothing to populate the element s attributes or its content. While IE4+ offers nonstandard innerTextand innerHTML shortcut properties to assign content to an element (and NN6 provides innerHTML), the DOM standard recommends adding child nodes to the new element (for more details, see Chapter 14). For example, if you wish to create a B element and its content, you first create the element and then append a text node, as in the following sequence: On the CD-ROM elementObject.appendChild()
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

152 Part III .Document Objects Reference Table (Web hosting bandwidth) 15-7

Thursday, September 27th, 2007

152 Part III .Document Objects Reference Table 15-7 (continued) DOMAttrModified mouseout DOMCharacterDataModified mouseover DOMFocusIn mouseup DOMFocusOut reset DOMNodeInserted resize DOMNodeInsertedIntoDocument scroll DOMNodeRemoved select DOMNodeRemovedFromDocument submit DOMSubtreeModified unload Note that the event types specified in the DOM Level 2 are more limited than the wide range of events defined in IE4+. Also, the W3C temporarily tabled the issue of keyboard events until DOM Level 3. Fortunately, Netscape implements keyboard events in a fashion that likely will appear as part of the W3C DOM. The second parameter of the addEventListener()method is a reference to the JavaScript function to be invoked. This is the same form used to assign a function to an event property of an object (for example, objReference.onclick = someFunction), and it should not be a quoted string. This approach also means that you cannot specify parameters in the function call. Therefore, functions that need to reference forms or form control elements must build their own references (with the help of the event object s property that says which object is the event s target). By default, the W3C DOM event model has events bubble upward through the element container hierarchy starting with the target object of the event (for example, the button being clicked). However, if you specify true for the third parameter of the addEventListener() method, event capture is enabled for this particular event type whenever the current object is the event target. This means that any other event type targeted at the current object bubbles upward unless it, too, has an event listener associated with the object and the third parameter is set to true. NN6 does not always set event capture for an element, even when you specify true as the third parameter of addEventListener(). For the most part, you can make do with event bubbling by adding an event listener to a container higher up the element hierarchy. Because event capture is a part of the W3C DOM event model, this feature will likely be implemented in a future version of NN. Using the addEventListener() method requires that the object to which it is attached already exist. Therefore, you most likely will use the method inside an initialization function triggered by the onLoadevent handler for the page. (The document object can use addEventListener()for the load event immediately because the document object exists early in the loading process.) Caution elementObject.addEventListener()
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Web server hosting - 151Chapter 15 .Generic HTML Element Objects Example (with

Thursday, September 27th, 2007

151Chapter 15 .Generic HTML Element Objects Example (with Listings 15-19a and 15-19b) on the CD-ROM Related Items: readyState property; removeBehavior() method; behaviors (Chapter 48). addEventListener( eventType , listenerFunc, useCapture) removeEventListener( eventType , listenerFunc, useCapture) Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The W3C DOM s event mechanism accommodates both event bubbling and trickling (see Chapter 29). While the new mechanism supports the long-standing notion of binding an event to an element by way of HTML attributes (for example, the old onClick event handler), it encourages binding events by registering an event listener with an element. (In browsers that support the W3C event model, other ways of binding events such as event handler attributes are internally converted to registered events.) To tell the DOM that an element should listen for a particular kind of event, use the addEventListener()method on the element object. The method requires three parameters. The first is a string version of the event type for which the element should listen. Event type strings do not include the well-used on prefix of event handlers. Instead, the names consist only of the event and are usually in all lowercase (except for some special system-wide events preceded by DOM). Table 15-7 shows all the events recognized by the W3C DOM specification (although NN6 may not implement them all). Table 15-7 W3C DOM Event Listener Types abort error blur focus change load click mousedown DOMActivate mousemove Continued On the CD-ROM elementObject.addEventListener()
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Best web design - 150 Part III .Document Objects Reference To guarantee

Wednesday, September 26th, 2007

150 Part III .Document Objects Reference To guarantee that an element gets only one ID assigned to it while the object exists in memory, assign the value via the uniqueIDproperty of that same object not some other object. Once you retrieve the uniqueID property of an object, the property s value stays the same no matter how often you access the property again. In general, you assign the value returned by the uniqueIDproperty to the object s id property for other kinds of processing. (For example, the parameter of a getElementById() method requires the value assigned to the id property of an object.) Example (with Listing 15-18) on the CD-ROM Related Items: id property; getElementById() method. Methods addBehavior( URL ) Returns: Integer ID. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The addBehavior() method imports an external Internet Explorer behavior and attaches it to the current object, thereby extending the properties and/or methods of that object. See Chapter 48 for details on IE behaviors (new in IE5 for Windows). The sole parameter of the addBehavior() method is a URL pointer to the behavior component s code. This component may be in an external file (with an .htc extension), in which case the parameter can be a relative or absolute URL. IE also includes a library of built-in (default) behaviors, whose URLs are in the following format: #default#behaviorName Here, behaviorName is one of the default behaviors (see Chapter 48). If the behavior is imported into the document via the OBJECT tag, the addBehavior() method parameter is the ID of that element in the following format: #objectID When you add a behavior, the loading of the external code occurs asynchronously. This means that even though the method returns a value instantly, the behavior is not necessarily ready to work. Only when the behavior is fully loaded can it respond to events or allow access to its properties and methods. Behaviors loaded from external files observe domain security rules. The behavior component and the HTML page that loads it must come from the same server and domain; they also must load via the same protocol (for example, http://, https://, and file:// are mutually exclusive, mismatched protocols). On the CD-ROM elementObject.addBehavior()
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.