15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1 ✦ Generic HTML Element Objects (Chapter 15)<br />

<br />

<br />

onBeforeCopy Event Handler<br />

<br />

Select one or more characters in the following paragraph. Then<br />

execute a Copy command via Edit or context menu.<br />

Lorem ipsum dolor sit amet,<br />

consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut<br />

labore et dolore magna aliqua. Ut enim adminim veniam, quis nostrud<br />

exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br />

<br />

Paste results here:<br />

<br />

<br />

<br />

<br />

<br />

onBeforeCut<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓<br />

Example<br />

You can use the onBeforeCut event handler to preprocess information prior to<br />

an actual cut action. You can try this by editing a copy of Listing 15-33, changing the<br />

onBeforeCopy event handler to onBeforeCut. Notice that in its original form, the<br />

example does not activate the Cut item in either the context or Edit menu when you<br />

select some text in the second paragraph. But by assigning a function to the<br />

onBeforeCut event handler, the menu item is active, and the entire paragraph is<br />

selected from the function that is invoked.<br />

onBeforeDeactivate<br />

See onActivate.<br />

onBeforeEditFocus<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓<br />

97<br />

elementObject.onBeforeEditFocus

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!