Advanced Search

The Green Industry's Resource Center


  #1  
Old 04-04-2007, 04:46 PM
Vikings Vikings is offline
LawnSite Bronze Member
 
Join Date: Sep 2006
Location: canada
Posts: 1,667
I want a "text bigger" button.

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?
Reply With Quote
  #2  
Old 04-04-2007, 11:48 PM
topsites topsites is offline
LawnSite Fanatic
 
Join Date: Mar 2005
Location: Richmond Virginia
Posts: 21,659
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...
Reply With Quote
  #3  
Old 04-05-2007, 12:11 AM
Dirty Water's Avatar
Dirty Water Dirty Water is offline
LawnSite Fanatic
 
Join Date: May 2005
Location: Redmond, WA
Posts: 6,800
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.
Reply With Quote
  #4  
Old 04-05-2007, 01:31 AM
Vikings Vikings is offline
LawnSite Bronze Member
 
Join Date: Sep 2006
Location: canada
Posts: 1,667
Quote:
Originally Posted by Dirty Water View Post
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.
That's pretty cool Thanks.

*crosses fingers in case he's a hacker*
Reply With Quote
  #5  
Old 04-05-2007, 01:37 AM
Dirty Water's Avatar
Dirty Water Dirty Water is offline
LawnSite Fanatic
 
Join Date: May 2005
Location: Redmond, WA
Posts: 6,800
Not a hacker, Let me know if you need help integrating it into your site.
Reply With Quote
  #6  
Old 04-17-2007, 02:31 AM
mdvaden's Avatar
mdvaden mdvaden is offline
LawnSite Bronze Member
 
Join Date: Mar 2003
Location: Westside Oregon
Posts: 1,912
Seems that

http://www.dynamicdrive.com

has some goodies for that in their arsenal of toys, too.
__________________
Photographer & Arborist

Coast Redwoods Info . . . Portland Landscape Pruning Consultation . . . M. D. Vaden Photography
Reply With Quote
  #7  
Old 04-17-2007, 08:00 AM
StBalor StBalor is offline
LawnSite Senior Member
 
Join Date: Mar 2006
Location: Millersville, Maryland
Posts: 800
Quote:
Originally Posted by topsites View Post
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...

Thanks for the tip topsites, i did not know that.
__________________
why i like cutting lawns so much:

It's the only job i know,
Where i can walk in circles and talk to myself
And no one thinks i'm crazy.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Layout Style:




Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
Copyright ©1998 - 2012, LawnSite.comô - Grand View Media
All times are GMT -4. The time now is 09:49 PM.

Page generated in 0.07780 seconds with 8 queries