Web effects set Font size code
Here to provide one or two JS set font size Oh, one is set up large and small three font size, one is based on the user input 1-7 font size can confirm the size of the JS code.
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.111cn.net/tr/xhtml1/dtd/xhtml1-
Transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<style>
#content {font-size:12px;
line-height:200%;
padding:10px;
}
</style>
<script language= "Web Effects" >
function SetFont (size)
{
var obj;
Obj=document.getelementbyid ("content");
Obj.style.fontsize=size;
Obj.style.color= "#ff0000";
}
</script>
<body>
<div> font: <a href= "#" onclick= "Javascript:setfont (' 12px ')" > Small </a><a href= "#" onclick= "javascript : SetFont
(' 18px '); " > </a><a href= "#" onclick= "Javascript:setfont (' 24px ');" > Big </a></div>
<div id= "Content" >
Http://www.111cn.net welcome everyone to visit.
</div>
</body>
Method Two
<script>
function Wahaha ()
{
var fontsize = parseint (document.getElementById (' Tbox '). value,10);
if (isNaN (fontsize) | | | fontsize>6 | | fontsize<1)
{
Alert (' Please enter 1-7 direct digits ');
Return
}
var sp = document.getElementById (' span1 ');
var txt = sp.innertext;
var Objfont = document.createelement ("h" +fontsize);
Objfont.innertext = txt;
sp.innerhtml = "";
Sp.appendchild (Objfont);
}
</script>
<body>
<span id= "Span1" > Last night the Stars last night, painting building west Side Cassia East </span>
<input id= "Tbox" type= "text" onchange= "Wahaha ()" >
</body>