<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function addClass() {
this.parentNode.className += ' MyClassName';
var e = arguments[0] || window.event;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
}
var i, list = document.getElementsByClassName('more'), length = list.length, ie = 0 /*@cc_on + 1 @*/;
for(i = 0; i < length; i++) {
if(ie) {
var listener = function() {
addClass.call(list[i]);
};
list[i].attachEvent('onclick', listener);
}
else list[i].addEventListener('click', addClass, false);
}
/*]]>*/
</script>
</head>
<body>
<div class="block">
<h4>Lorem ipsum</h4>
<dfn>Sed diam nonumy eirmod tempor invidunt ut labore et dolore. </dfn>
<a href="javascript:addClass();" class="more">more info</a>
</div>
</body>
</html> |