开发者

mark text onclick for all code tags

I use lots of code tags in a personal wiki (TiddlyWiki). I would like to have the text in the code tags automatically marked whenever I click on it.

The problem is I can't add 开发者_Go百科onclick events inside the code tags.

Is it possible to add this in the JavaScript code? Something like:

document.body.getElementsByTagName("code") if onclick select();


Yes, you can do it.

Following are the list of attributes available for <code> tag.

dir         Specifies the direction of the text
class       Document wide identifier.
id          Document wide identifier
lang        Language code
title       Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip").
style       Inline style (CSS)
onclick     Intrinsic event (see event handlers)
ondbclick   Intrinsic event (see event handlers)
onmousedown Intrinsic event (see event handlers)
onmouseup   Intrinsic event (see event handlers)
onmouseover Intrinsic event (see event handlers)
onmousemove Intrinsic event (see event handlers)
onmouseout  Intrinsic event (see event handlers)
onkeypress  Intrinsic event (see event handlers)
onkeydown   Intrinsic event (see event handlers)
onkeyup     Intrinsic event (see event handlers)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜