Switch to full style
JavaScript code examples
Post a reply

change font size in JavaScript

Thu Sep 15, 2011 8:31 pm

Following example is on how to change the font size using JavaScript:
Code:

<html>
<
title>change font size</title>
<
head>
<
script language="JavaScript" type="text/javascript">
function changeSize(size){
    // change div text font size.
    document.getElementById("text").style.fontSize = size;
}
</script>
</head>
<body>
Select size:
<select name="sizeselect" onchange="changeSize(this.value)">
 <option value="10">10</option>
 <option value="13">13</option>
 <option value="15">15</option>
 <option value="17">17</option>
 <option value="19">19</option>
 <option value="21">21</option>
 <option value="23">23</option>
 <option value="50">50</option>
</select>
<div id="text">
  This is a font size changer using javascript .
</div>
</body>
</html>




Post a reply
  Related Posts  to : change font size in JavaScript
 How to use Javascript animation to change the size of a div?     -  
 chainge Font size of drawing     -  
 Control font size of sub and sup text     -  
 Change the td font style     -  
 change the font style of the body tag     -  
 change Font of text in java     -  
 Change the link font family and weight     -  
 Change Image File Size (Height And Width) While Uploading     -  
 Set image size as a percentage of the page size     -  
 CSS used font families     -  

Topic Tags

JavaScript Variables