Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do you make the text increase and decrease with the rest of the page?

    <script language="JavaScript">
    function SelectSize()
    {
    var dropDown=document.getElementById("size");
    var SelectedSize = dropDown.options[dropDown.selectedIndex].text;
    }
    { document.getElementById().style.fontSize=SelectedSize; }
    }
    </script>
    </head>

    <body>
    <form name="frmcontrol">
    Change Size of Text<p>
    <select id=size onChange="SelectSize()" >
    <option value="8">8px</option>
    <option value="9">9px</option>
    <option value="10">10px</option>
    <option value="12">12px</option>
    <option value="15">15px</option>
    <option value="20">20px</option>
    <option value="25">25px</option>
    <option value="72">72px</option>
    </select>
    </form>

    <script language="javascript">

    function colorChange()
    {
    document.bgColor=document.list.colors.options[document.list.colors.selectedIndex].value;
    }
    </script>

    Change Background Color:
    <form name="list">
    <select name="colors">
    <option value="006633">Default
    <option value="black">Black
    <option value="green">Green
    </select>
    <input type="button" value="Change Background color" name="myButton" onClick="colorChange()" />
    </form>

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title> New Document </title>
    </head>
    
    <body>
    <script type="text/javascript">
    function SelectSize()
    {
       var dropDown=document.getElementById("size");
       var SelectedSize = dropDown.options[dropDown.selectedIndex].text;
       document.body.style.fontSize=SelectedSize;
    }
    </script>
    
    <form name="frmcontrol">
    Change Size of Text<p>
    <select id=size onChange="SelectSize()" >
    <option value="8">8px</option>
    <option value="9">9px</option>
    <option value="10">10px</option>
    <option value="12">12px</option>
    <option value="15">15px</option>
    <option value="20">20px</option>
    <option value="25">25px</option>
    <option value="72">72px</option>
    </select>
    </form>
    
    </body>
    </html>

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •