改变字体大小
来源:互联网 发布:天下三女号捏脸数据 编辑:程序博客网 时间:2024/05/16 00:58
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <style type="text/css"> * { margin: 0; padding: 0; } .msg { width: 300px; margin: 100px; } .msg_caption { width: 100%; overflow: hidden; margin-bottom: 1px; } .msg_caption span { display: block; float: left; margin: 0 2px; padding: 4px 10px; background: #898989; cursor: pointer; font-size: 12px; color: white; } .msg textarea { width: 300px; height: 80px; height: 100px; border: 1px solid #000; } </style> <script src="JS/jquery-1.3.2.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $("span").click(function() { //先获取原始的字体大小 var thisEle = $("#para").css("font-size"); // 获取文字大小 //alert(thisEle); var textFontSize = parseFloat(thisEle, 10); // 获取单位 var unit = thisEle.slice(-2); // 获取点击标签的class var cName = $(this).attr("class"); if (cName == "bigger") { if (textFontSize <= 22) { textFontSize += 2; } } else if (cName == "smaller") { if (textFontSize >= 12) { textFontSize -= 2; } } //加完数值加上单位 $("#para").css("font-size", textFontSize + unit); }); }); </script></head><body> <form id="form1" runat="server"> <div class="msg"> <div class="msg_caption"> <span class="bigger">放大</span> <span class="smaller">缩小</span> </div> <div> <p id="para"> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </p> </div> </div> </form></body></html>
- 改变字体大小
- 改变字体大小
- 改变字体大小
- ctrl+滚轮 改变字体大小
- 改变EDIT框字体大小
- 改变文本字体大小
- JQUERY改变字体大小
- 改变按钮字体大小
- java eclipse改变字体大小
- MFC 改变控件字体大小
- MFC 改变控件字体大小
- 怎么改变整体字体大小
- 改变PowerDesigner数据模型字体大小
- 如何改变eclipse字体大小
- Ubuntu 改变tty2字体大小
- listview改变字体大小
- CfontDialog改变字体大小
- MFC 改变控件字体大小
- 机器学习入门资料
- Linux内核入门(三)—— C语言基本功
- Android 2.3 StageFright 如何选定OMX 组件的
- 解读WINCE 5.0 KITL代码流程
- Android开机动画详解
- 改变字体大小
- mysql 用load data 导入数据时,数据被截断问题
- 黑马程序员 java学习笔记2-IO流
- Android开发——浅谈onInterceptTouchEvent、onTouchEvent与onTouch
- C# 修饰符
- 不在沉沦中死去,就在奋起中崛起
- getuid,setuid函数
- 文本文件和二进制文件区别
- 编程中的快捷键