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 to the CF scene
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Editable text color/size/typeface

    hi,

    im currently designing a website to go along with university dissertation.

    i need to give the user of the site the ability to change the typeface, font size and font color.

    i have a code that can currently change these features in one ID tag, however i need to be able to edit the text in multiple div tags.

    my javascript looks like this:

    Code:
    <head>
    <script language=javascript>
    function changeStyle(element,property,value) {
    document.getElementsById(element).style[property] = value;
    }
    </script>
    </head>
    and an example of my body looks like this:

    Code:
    <body>
    <SELECT style="WIDTH: 100px" onchange="javascript:changeStyle('text', 'color', this.value);" size=1 name=fntcolour> 
    <option style="background:#000000;color:white;" value="#000000">black</option>
    <option style="background:#d60000;" value="#d60000">red</option>
    <option style="background:#ec4c00;" value="#ec4c00">orange</option>
    <option style="background:#eedb02;" value="#eedb02">yellow</option>
    <option style="background:#00a652;" value="#00a652">green</option>
    <option style="background:#00bff3;" value="#00bff3">blue</option>
    <option style="background:#93268f;" value="#93268f">violet</option>
    <option style="background:#FFFFFF;" value="#FFFFFF" selected>white</option>
    </body>
    any help would e greatly appreciated.

    Thanks
    John

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Easier solution is to have a css file attachd and change the cs className for the body tag to adjust the new settings.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Tags for this Thread

    Posting Permissions

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