1. I've started a massive SPAM purge, any accounts that have spammed are being removed, also for a short period new user signups are disallowed until the SPAM cleaning is finished.

Using JavaScript to Change Your Web Page Font Size

Discussion in 'Java Script/AJAX' started by JavaScript, Aug 12, 2010.

  1. JavaScript

    JavaScript New Member

    Joined:
    Nov 25, 2009
    Messages:
    16
    Likes Received:
    1
    Trophy Points:
    0
    In this short JavaScript tutorial, Nurani guides you how to use JavaScript in changing the web page's font size. Maybe the JavaScripts to change font size are not new things on ... detail at JavaScriptBank. com - 2.000+ free JavaScript codes

    [​IMG]
    Demo: JavaScript Using JavaScript to Change Your Web Page Font Size

    How to setup

    Step 1: Use JavaScript code below to setup the script
    JavaScript
    Code (Text):
    <script type="text/javascript">
    var min=8;
    var max=18;
    function zoominLetter() {
       var p = document.getElementsByTagName('p');
       for(i=0;i<p.length;i++) {
          if(p[i].style.fontSize) {
             var s = parseInt(p[i].style.fontSize.replace("px",""));
          } else {
             var s = 12;
          }
          if(s!=max) {
             s += 1;
          }
          p[i].style.fontSize = s+"px"
       }
    }
    function zoomoutLetter() {
       var p = document.getElementsByTagName('p');
       for(i=0;i<p.length;i++) {
          if(p[i].style.fontSize) {
             var s = parseInt(p[i].style.fontSize.replace("px",""));
          } else {
             var s = 12;
          }
          if(s!=min) {
             s -= 1;
          }
          p[i].style.fontSize = s+"px"
       }
    }
    </script>
    Step 2: Place HTML below in your BODY section
    HTML
    Code (Text):
    <a href="javascript:zoominLetter();">A</a>
    <a href="javascript:zoomoutLetter();">a</a>





    JavaScript Countdown Timer - JavaScript Web based Music Player - Free JavaScript Codes​
    Loading...
  2. PradeepKr

    PradeepKr New Member

    Joined:
    Aug 16, 2010
    Messages:
    21
    Likes Received:
    1
    Trophy Points:
    0
    Can't we do that by changing whole css linked to the document in <head> section? In one shot.
  3. liveseosolution

    liveseosolution New Member

    Joined:
    Jun 9, 2011
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    This is nice JavaScript tutorial. I am very pleased to find the thread.

Share This Page