By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,620 Members | 1,302 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,620 IT Pros & Developers. It's quick & easy.

enlarge text

P: 10
Hi everyone,
Happy New Year, I found these line of javascript code to enlarge your font size.
this works but i can only set it up in one area or div area. is there a way i can use this function in other div area?

Thanks

Expand|Select|Wrap|Line Numbers
  1. function changeTextSize(amount) {
  2.     if (amount=="1") {
  3.         if (document.getElementById) {document.getElementById('intMainCellTextBlock').style.fontSize = '11px';} else {document.all.intMainCellTextBlock.style.fontSize = '11px';}
  4.         if (document.getElementById) {document.getElementById('intMainCellTextBlock').style.lineHeight = '13px';} else {document.all.intMainCellTextBlock.style.lineHeight = '13px';}
  5.     } else if (amount=="2") {
  6.         if (document.getElementById) {document.getElementById('intMainCellTextBlock').style.fontSize = '12px';} else {document.all.intMainCellTextBlock.style.fontSize = '12px';}
  7.         if (document.getElementById) {document.getElementById('intMainCellTextBlock').style.lineHeight = '14px';} else {document.all.intMainCellTextBlock.style.lineHeight = '14px';}
  8.     } else if (amount=="3") {
  9.         if (document.getElementById) {document.getElementById('intMainCellTextBlock').style.fontSize = '13px';} else {document.all.intMainCellTextBlock.style.fontSize = '13px';}
  10.         if (document.getElementById) {document.getElementById('intMainCellTextBlock').style.lineHeight = '15px';} else {document.all.intMainCellTextBlock.style.lineHeight = '15px';}
  11.     }
  12. }
Jan 10 '08 #1
Share this Question
Share on Google+
2 Replies


gits
Expert Mod 5K+
P: 5,333
why not? :)

replace the id 'intMainCellTextBlock' with a variable node_id and pass it to the function. so node_id is the id of your desired textarea ...

Expand|Select|Wrap|Line Numbers
  1. function changeTextSize(amount, node_id) {
  2.     if (amount=="1") {
  3.         if (document.getElementById) {
  4.             document.getElementById(node_id).style.fontSize = '11px';
  5.         }
  6.         // and further code follows analogue
  7. }
  8.  
kind regards
Jan 10 '08 #2

P: 10
why not? :)

replace the id 'intMainCellTextBlock' with a variable node_id and pass it to the function. so node_id is the id of your desired textarea ...

Expand|Select|Wrap|Line Numbers
  1. function changeTextSize(amount, node_id) {
  2.     if (amount=="1") {
  3.         if (document.getElementById) {
  4.             document.getElementById(node_id).style.fontSize = '11px';
  5.         }
  6.         // and further code follows analogue
  7. }
  8.  
kind regards

thanks i'll give it a try.
Jan 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.