<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> $(function(){ $("Span"). Click (function(){ varThisele = $ ("#para"). CSS ("Font-size")); varTextfontsize = parsefloat (Thisele, 10);
//parsefloat (the first parameter, 10) 10 indicates a conversion to 10 binary
Http://www.w3school.com.cn/jsref/jsref_parseFloat.asp
var//
//The Arrayobject.slice (start,end) method returns the selected element from an existing array. //start required. Specify where to start the selection. If it is a negative number, it specifies the position from the end of the array. In other words, 1 refers to the last element, 2 refers to the second-lowest element, and so on. //End is optional. Specifies where to end the selection. The parameter is the array subscript at the end of the array fragment. If this parameter is not specified, then the segmented array contains all elements from start to end of the array. If//This parameter is a negative number, it specifies the element starting from the tail of the array. Http://www.w3school.com.cn/jsref/jsref_slice_array.asp varCName = $ ( This). attr ("Class"); Console.info ("Thisele:" + Thisele + "Textfontsize:" + textfontsize + "unit:" + unit + "CName:" +cName);
//thisele:16px textfontsize:16 unit:px cname:bigger if(CName = = "bigger")){ if(Textfontsize <= 22) {textfontsize+ = 2; } }Else if(CName = = "smaller")){ if(Textfontsize >= 12) {textfontsize-= 2; } } $("#para"). CSS ("Font-size", Textfontsize +unit); }); }); </script>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></body>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;}
jquery Web page font size changed