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

    default fontsize

    This should be simple but it's not, atleast for me, I'm trying to get the default fontsize to 14 and have the option as "default" in the javascript. <DFSIZE='14'></DFSIZE='14'>

    <script type="text/javascript">
    function SelectSize()
    {
    var dropDown=document.getElementById("size");
    var SelectedSize = dropDown.options[dropDown.selectedIndex].text;
    document.body.style.fontSize=SelectedSize;
    }
    </script>
    Change Size of Text
    <form name="frmcontrol">
    <select id=size onChange="SelectSize()" >
    <option value= "something I need help with">Default
    <option value="8">8px
    <option value="12">12px
    <option value="18">18px
    </select>
    </form>

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    function SelectSize()
    {
    var dropDown=document.getElementById("size");
    var SelectedSize = dropDown.options[dropDown.selectedIndex].value;
    document.body.style.fontSize=SelectedSize + "px";
    }
    *keep it simple (TM)


  •  

    Posting Permissions

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