I want a "text bigger" button.

Discussion in 'Digital Marketing' started by Vikings, Apr 4, 2007.

  1. Vikings

    Vikings LawnSite Bronze Member
    from canada
    Posts: 1,657

    I had a website, my weather channel I thought though it's not there now, and it had a button that controlled text size. I'm trying to make a site with a template that has small writing and I thought it would be nice to have that "make text bigger" button in there.
    I know about Ctrl++ but anyone know where a script is that I could place in my site?
     
  2. topsites

    topsites LawnSite Fanatic
    Posts: 21,653

    Oh, I always use Ctrl w/ mouse wheel lol, that ctrl + is a neat trick.
    You might check into radio buttons, likely along the lines of a javascript, but idk...
     
  3. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,794

    Here is something I just wrote for you.

    Code:
    <html>
    	<head>
    		<title>Text size Control Via Javascript</title>
    	</head>
    	<script language="javascript">
    		function ChangeFontSize()
    		{
    			var newFontSize;
    			var selIndex = document.frmTextSize.ddlFontSizeSelector.selectedIndex;
    			
    			newFontSize = document.frmTextSize.ddlFontSizeSelector.options[selIndex].value;
    			document.body.style.fontSize = newFontSize;
    		}
    	</script>
    	<body>
    	
    	<p>Test Text!Test Text!Test Text!Test Text!Test Text!Test Text!Test Text!Test Text!Test Text!</p>
    	
    	<form id="frmTextSize" name="frmTextSize">
    		<select id="ddlFontSizeSelector" onclick="ChangeFontSize();">
    			<option value="10pt">Tiny</option>
    			<option value="12pt" selected>Small</option>
    			<option value="14pt">Medium</option>
    			<option value="16pt">Large</option>
    			<option value="18pt">Huge</option>
    		</select>
    	</form>
    	</body>
    </html>
    
    Obviously, modify it to work in your site. It works off modifying the body tags style sheet element, so any inline styles will override it, but that could be modified.

    You can view it in action here.
     
  4. Vikings

    Vikings LawnSite Bronze Member
    from canada
    Posts: 1,657

    That's pretty cool Thanks.

    *crosses fingers in case he's a hacker*
     
  5. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,794

    Not a hacker, Let me know if you need help integrating it into your site.
     
  6. mdvaden

    mdvaden LawnSite Bronze Member
    Posts: 1,945

  7. StBalor

    StBalor LawnSite Senior Member
    Posts: 798


    Thanks for the tip topsites, i did not know that.
     

Share This Page