PDA

View Full Version : Document Text Sizer



bassa
10-20-2008, 07:20 AM
Script Title: Document Text Sizer

Script URL (on DD): Document Text Sizer (http://www.dynamicdrive.com/dynamicindex9/textsizer.htm)

Describe problem: I am using this nice little javascript on my website to allow users to resize the text on my webpages.

I have it working perfectly, and with no problems, but I am looking to add more tags to the javascript.

The two CSS buttons that controls the increase and decrease of the text size looks like this:

<a href="javascript:ts('textarea',-1)" class="decrease"></a>
<a href="javascript:ts('textarea',1)" class="increase"></a>

That makes the javascript resize all text within the
<div id="textarea"> container.

I would like to add another Div ID to the increase/decrease buttons, though, so that the text in my
<div id="footer">, which is outside the
<div id="textarea">, will also have its text increased/decreased.

I have tried putting in the footer this way;
<a href="javascript:ts('textarea','footer',-1)" class="decrease">, but that didn't work.

How do I do this?


Cheers,
Bassa

rangana
10-21-2008, 01:02 AM
Have you tried on just adding highlighted instead:


<a href="javascript:ts('textarea',-1);ts('footer',-1)" class="decrease"></a>
<a href="javascript:ts('textarea',1);ts('footer',1)" class="increase"></a>


Also, you should use onclick instead of the (deprecated) pseudo-url:


<a href="#" onclick="ts('textarea',-1);ts('footer',-1);return false;" class="decrease"></a>
<a href="#" onclick="ts('textarea',1);ts('footer',1);return false;" class="increase"></a>


Hope that helps.

bassa
10-21-2008, 07:41 AM
Thanks Rangana, that actually worked. However, it seems to work sporadically.

For instance, if I re-load the webpage, and click on the 'Lille Tekst' (which means 'Smaller Text' in my language), the textarea and the footer gets resized down one step.

But if I then click on the text increase button ('Stor Tekst'), only the footer gets bigger, and the textarea doesn't react to the click.

Any ideas?