<html> | |
<head> | |
<script> | |
function changeFontSize(element,step) | |
{ | |
step = parseInt(step,10); | |
var el = document.getElementById(element); | |
var curFont = parseInt(el.style.fontSize,10); | |
el.style.fontSize = (curFont+step) + 'px'; | |
return; | |
} | |
</script> | |
</head> | |
<body> | |
<p> | |
<a href="javascript:void(0);" onclick="changeFontSize('content','2');">Increase font</a> | |
| |
<a href="javascript:void(0);" onclick="changeFontSize('content',-2);">Decrease font</a> | |
</p> | |
<p id="content" style="font-size:12px;"> | |
My name is Sherlock Holmes. It is my business to know what other people don't know. | |
</p> | |
</body> | |
</html> |
Out Put:
Increase font Decrease font
My name is Sherlock Holmes. It is my business to know what other people don't know.
No comments:
Post a Comment