Home > Web Front-end > JS Tutorial > body text

Javascript implements control of text display in large, medium and small sizes_javascript skills

WBOY
Release: 2016-05-16 16:01:55
Original
1073 people have browsed it

On some website content pages, you usually see controlled text displayed in three ways: large, medium, and small. Let’s record this small function. It is still helpful to improve the user experience of the website!

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>js控制文字大中小显示</title> 
</head> 
<body> 
<script language="javascript"> 
function setFontSize(objID,size){ 
  document.getElementById(objID).style.fontSize=size+'px'; 
} 
</script> 
<div id="content"> 
<p>数据库(主要是MySQL和Access数据库),javascript,jquery,div+css,html,windows系统,linux系统以及健康养生方面的学习笔记和生活经验积累!</p> 
</div> 
<a onclick="setFontSize('content',20)">大</a> 
<a onclick="setFontSize('content',14)">中</a> 
<a onclick="setFontSize('content',12)">小</a> 
</body> 
</html> 
Copy after login

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!