Archive for June, 2008

DHTML Object Model (DOM)

The majer component of  the DOM are :

 

The object model focuses on collections of elements, a hierarchy of groupings that the elements fall into. The most important of these collections are:-

  • The  all  collection :-  Each element object has an all collection that contains all the elements that are beneath that element in the hierarchy.
  • The children  collection :- children collection that contains only the elements that are direct descendants of that element.

Example

 

<HTML>

    <BODY>

        <DIV>

            <P>Some text in a

                <B>paragraph</B>

            </P>

            <IMG id=image1 src=”mygif.gif”>

        </DIV>

        <IMG id=image2 src=”mygif.gif”>

    </BODY>

</HTML>

  • the div  object contains (and is the parent of) the p object and the img object called image1.
  • image1 and the p are children of the div. The img object called image2, however, is a child of the body object.
  • the b would be in the div object’s all collection, but would not appear in the div object’s children collection. Similarly, the div is a member of the body object’s children collection, but the p is not.

 

 

Internet Explorer supports the all collection whereas the W3C standard uses the getElementById() method. Describe the difference this makes to accessing a particular HTML element in JavaScript.

 

In Internet Explorer the HTML elements on a Web page that are the source of the events, and the types of events that are generated, have been greatly expanded. Previously, only a small set of HTML elements could generate events, such as anchors, image maps, form elements, applications, and objects. With the Internet Explorer event model, every HTML element on the page can be the source for a full set of mouse and keyboard events. Where as the getElementById() method  allows users to access html element by tag element only

 

Difference between the keypress and keydown event?

 

  • keypress Fires when the user presses an alphanumeric key.( Presses and releases a key (full down-and-up cycle). However, if a key is held down, multiple onkeypress events are fired.)
  • Keydown Fires when the user presses a key. ( Only a single event is fired, even if the key is held down.)

 

What is meant by event bubbling?

 

Event bubbling as a new way to handle events. This technique is used to process events in their user interfaces. Previously, if an HTML element generated an event, but no event handler was registered for it, the event would disappear, never to be seen again. Event bubbling simply passes these unhandled events to the parent element for handling. The event continues up (“bubbles up”) the element hierarchy until it is handled, or until it reaches the topmost object, the document object..

 

How do you cancel an event?

 

To cancel an event, we set the  Window.event.cancelBubble  property to “true” in the event handler. unless canceled, events will bubble up the hierarchy and be handled by all parent elements registered to the event, even if the event has already been handled.

 

 

 

 

 

 

 

 

Leave a Comment

Twitter on the web

What Twitter is?

Twitter is a free social network  service that allows users to send “updates” (or “tweets”; text-based posts, up to 140 characters long) to the Twitter web site, via the Twitter web site, short message service  (SMS), instance massage, or a third-party application such as Face book.

Updates are displayed on the user’s profile page and instantly delivered to other users who have signed up to receive them. The sender can restrict delivery to those in his or her circle of friends (delivery to everyone is the default). Users can receive updates via the Twitter website, instant messaging, SMS, SRSS, email or through an application. For

Why it might be useful?

People use Twitter as a form of communication. Think of it as an instant message that goes out to a ton of people at once. If you want to let your friends know you’re headed to your favourite hang-out tonight, you can shoot them all a quick message without having to send a dozen emails. If you want feedback on an idea, you can tap into your network to ask a quick question. If you simply want to learn a little more about people you’ve heard of online, you can follow their tweets and “eavesdrop” in an acceptable way. In fact, I’ve found quite a few practical reasons to use Twitter, which I’ll outline later in the series.

What is meant by a follower?

Following someone simply means receiving their Twitter updates.  How you receive the updates (on your phone, IM, or just on the web) is up to you.  You can set your following preferences based on device, and then set notification preferences for each person you follow.  Your followers are those who have elected to receive your twitters.

What does it mean to be followed?

To receive the twitters from the others.

 

Leave a Comment