DigitalBonsai

Shaping the Web

Happiness is in the doing.

Attribute Handling and Event Registration

Below are some sentences. Clicking a sentence will either assign it a DOM id or remove it, depending if one exists or not. The unique id is created by a concatenation of the client's IP address and the time (milliseconds from Jan 1, 1970 UTC). To be able to reference just the IP, an MD5 encryption is applied to it to ensure it is still unique, but a fixed length. That way, when each span is selected by a user, the corresponding id is unique to the user by the IP address, and unique from each other by appending the time it was clicked.

Each span does not need to have functions tied to them. One function on the paragraph that contains the spans collects the span objects within it and sets the javascript events on them when hovered and removes the functions when the mouse exits. Hovering over a sentence will show it's id in the indicated area below.

Click this sentence. Click this sentence. Click this sentence. Click this sentence.

Click this sentence. Click this sentence. Click this sentence. Click this sentence.

Sentence ID Attributes :
Hovered ID :