Solved

How to change this font change code ?

Posted on 2004-10-02
37
515 Views
Last Modified: 2013-12-03
Hi, Experts:
I have this code is working fine. However, I can only change font size px by px. I also need to set the defult font size to the 14px. So the font can change from 14px down to 11px or 14px up to 17px. I would like to ask. how am I be able to change the font based on the current page font size, page defult font could be 12px ( so I don't need to set the defult size to 14px). Also, if there are different page fonts in one page (Ex. maybe 12px and 13px at same page). How can I change these different font to be smaller or larger at same time.....

Sincerely,

The example code is at below:
<html>
<head>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
myPix = new Array("dots/digital1.gif","dots/digital2.gif","dots/digital3.gif","dots/digital4.gif","dots/digital5.gif","dots/digital6.gif","dots/digital7.gif")
thisPic = 3
imgCt = myPix.length -1

function processPrevious(trgt,inc)
{if (document.images && thisPic > 0) {
                  thisPic--
                  document.myPicture.src=myPix[thisPic]

   
    if (!document.getElementById) return
 var d = document,cEl = null,sz = startSz,i,j,cTags;

 sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > 6 ) sz = 6;
 startSz = sz;

 if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

 cEl.style.fontSize = szs[ sz ];

 for ( i = 0 ; i < tgs.length ; i++ ) {
 cTags = cEl.getElementsByTagName( tgs[ i ] );
 for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
 }
}
}
function processNext(trgt,inc)
{
    if (document.images && thisPic < imgCt) {
                  thisPic++
                  document.myPicture.src=myPix[thisPic]
   
    if (!document.getElementById) return
 var d = document,cEl = null,sz = startSz,i,j,cTags;

 sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > 6 ) sz = 6;
 startSz = sz;

 if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

 cEl.style.fontSize = szs[ sz ];

 for ( i = 0 ; i < tgs.length ; i++ ) {
 cTags = cEl.getElementsByTagName( tgs[ i ] );
 for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
 }
}
}

//Specify affected tags. Add or remove from list:
 var tgs = new Array( 'div','td','tr');

 //Specify spectrum of different font sizes:
 var szs = new Array( '11px','12px','13px','14px','15px','16px','17px' );
 var startSz = 3;
//---------->
</SCRIPT>      
<style type="text/css">
<!--
.style2 {font-family: Arial; font-size: 14px; }
-->
</style>
</head>
<body>
<table width="329" border="0">
<tr>
<td width="117" align="right">Change font size</td>
<td width="48" align="right"><A HREF="javascript:processPrevious('body',-1)"><IMG SRC="arrows/reverse.gif" width="40" height="20" BORDER=0></a></td>
<td width="98" align="center"><IMG SRC="dots/digital4.gif" NAME="myPicture" width="81" height="20"></td>
<td width="48" align="left"><A HREF="javascript:processNext('body',1)"><IMG SRC="arrows/forward.gif" width="40" height="20" BORDER=0></a></td>
</tr>
</table>
<div class="style2">This is body text</div>
</body>
</html>
0
Comment
Question by:mingchih
  • 21
  • 14
  • +1
37 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 500 total points
ID: 12210459
Hi mingchih,

Well, you can change it based on the current page font-size by doing:

startSz = document.body.style.fontSize (I'm not sure)

You can set the starting out text like this:

<style type="text/css">
body {font-size:14px;}
</style>

You can change different parts of the page, let's say you have two <div>:

<div style="font-size:14px;">Hi!</div>
<div style="font-size:18px;">Boo!</div>

Regards,
Zyloch
0
 

Author Comment

by:mingchih
ID: 12210485
Hi:
I try the code. But the 18px will change back to 14px. It will not change begin from 18px....

Sincerely,
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210495
Does your Javascript have a szc array?
0
 

Author Comment

by:mingchih
ID: 12210539
yes, var szs = new Array( '11px','12px','13px','14px','15px','16px','17px' );

0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210542
Change it to this:

var szs = new Array(document.body.style.fontSize ,document.body.style.fontSize+1, document.body.style.fontSize+2, document.body.style.fontSize+3, document.body.fontSize+4, document.body.fontSize+5, document.body.fontSize+6);

And to make sure, I would recommend you to set the font-size:

<style type="text/css">

body {font-size:18px;}

</style>
0
 

Author Comment

by:mingchih
ID: 12210551
hi, it is not really working. I am post change code at below

<html>
<head>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
startSz = document.body.style.fontSize
myPix = new Array("dots/digital1.gif","dots/digital2.gif","dots/digital3.gif","dots/digital4.gif","dots/digital5.gif","dots/digital6.gif","dots/digital7.gif")
thisPic = 3
imgCt = myPix.length -1

function processPrevious(trgt,inc)
{if (document.images && thisPic > 0) {
                  thisPic--
                  document.myPicture.src=myPix[thisPic]

   
    if (!document.getElementById) return
 var d = document,cEl = null,sz = startSz,i,j,cTags;

 sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > 6 ) sz = 6;
 startSz = sz;

 if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

 cEl.style.fontSize = szs[ sz ];

 for ( i = 0 ; i < tgs.length ; i++ ) {
 cTags = cEl.getElementsByTagName( tgs[ i ] );
 for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
 }
}
}
function processNext(trgt,inc)
{
    if (document.images && thisPic < imgCt) {
                  thisPic++
                  document.myPicture.src=myPix[thisPic]
   
    if (!document.getElementById) return
 var d = document,cEl = null,sz = startSz,i,j,cTags;

 sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > 6 ) sz = 6;
 startSz = sz;

 if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

 cEl.style.fontSize = szs[ sz ];

 for ( i = 0 ; i < tgs.length ; i++ ) {
 cTags = cEl.getElementsByTagName( tgs[ i ] );
 for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
 }
}
}

//Specify affected tags. Add or remove from list:
 var tgs = new Array( 'div','td','tr');

 //Specify spectrum of different font sizes:
var szs = new Array(document.body.style.fontSize,document.body.style.fontSize+1, document.body.style.fontSize+2, document.body.style.fontSize+3, document.body.fontSize+4, document.body.fontSize+5, document.body.fontSize+6);
var startSz = 3;
//---------->
</SCRIPT>      
<style type="text/css">
<!--
body{font-size:18px;}
-->
</style>
</head>
<body>
<table width="329" border="0">
<tr>
<td width="117" align="right">Change font size</td>
<td width="48" align="right"><A HREF="javascript:processPrevious('body',-1)"><IMG SRC="arrows/reverse.gif" width="40" height="20" BORDER=0></a></td>
<td width="98" align="center"><IMG SRC="dots/digital4.gif" NAME="myPicture" width="81" height="20"></td>
<td width="48" align="left"><A HREF="javascript:processNext('body',1)"><IMG SRC="arrows/forward.gif" width="40" height="20" BORDER=0></a></td>
</tr>
</table>
<div style="font-size:14px;">This is body text</div>
<div style="font-size:18px;">This is body text</div>
</body>
</html>
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210553
You'd probably also want this:

var startSz = 3; to be var startSz = document.body.style.fontSize;
0
 

Author Comment

by:mingchih
ID: 12210562
ok, i did it. still not change.... I wonder about write second var szs = new Array( '11px','12px','13px','14px','15px','16px','17px' ); for other font size ?
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210575
If the changes I make apply to both the previous and next functions, I guess you should do them for both.

Try changing this:
sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > 6 ) sz = 6;
 startSz = sz;

to

sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > startSz+6 ) sz = startSz;
 startSz = sz;
0
 

Author Comment

by:mingchih
ID: 12210614
hi, still not change, i am post the new code below, thanks


<html>
<head>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
startSz = document.body.style.fontSize
myPix = new Array("dots/digital1.gif","dots/digital2.gif","dots/digital3.gif","dots/digital4.gif","dots/digital5.gif","dots/digital6.gif","dots/digital7.gif")
thisPic = 3
imgCt = myPix.length -1

function processPrevious(trgt,inc)
{if (document.images && thisPic > 0) {
thisPic--
document.myPicture.src=myPix[thisPic]

if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > startSz+6 ) sz = startSz;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
}
function processNext(trgt,inc)
{
if (document.images && thisPic < imgCt) {
thisPic++
document.myPicture.src=myPix[thisPic]

if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > startSz+6 ) sz = startSz;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
}

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');

//Specify spectrum of different font sizes:
var szs = new Array(document.body.style.fontSize,document.body.style.fontSize+1, document.body.style.fontSize+2, document.body.style.fontSize+3, document.body.fontSize+4, document.body.fontSize+5, document.body.fontSize+6);

var startSz = document.body.style.fontSize;
//---------->
</SCRIPT>
<style type="text/css">
<!--
body{font-size:18px;}
-->
</style>
</head>
<body>
<table width="329" border="0">
<tr>
<td width="117" align="right">Change font size</td>
<td width="48" align="right"><A HREF="javascript:processPrevious('body',-1)"><IMG SRC="arrows/reverse.gif" width="40" height="20" BORDER=0></a></td>
<td width="98" align="center"><IMG SRC="dots/digital4.gif" NAME="myPicture" width="81" height="20"></td>
<td width="48" align="left"><A HREF="javascript:processNext('body',1)"><IMG SRC="arrows/forward.gif" width="40" height="20" BORDER=0></a></td>
</tr>
</table>
<div style="font-size:14px;">This is body text</div>
<div style="font-size:18px;">This is body text</div>
</body>
</html>
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210623
Wait, I'm not too sure what your'e trying to do right now. I think you should undo what you did in my last step though. This is a sort of picture rotating script?
0
 

Author Comment

by:mingchih
ID: 12210649
ok, this is font change code. It is not picture rotating script. I did combine the font change code with cycling image code because I want to be able to use cycling image to show about font change ( has some dots to show which font they are change). thanks
0
 

Author Comment

by:mingchih
ID: 12210654
by the way, i undo the last step
sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > startSz+6 ) sz = startSz;
 startSz = sz;

back to

sz += inc;
 if ( sz < 0 ) sz = 0;
 if ( sz > 6 ) sz = 6;
 startSz = sz;

0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210666
Try this:

<html>
<head>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
startSz = document.body.style.fontSize
myPix = new Array("dots/digital1.gif","dots/digital2.gif","dots/digital3.gif","dots/digital4.gif","dots/digital5.gif","dots/digital6.gif","dots/digital7.gif")
thisPic = 3
imgCt = myPix.length -1

function changeSize(num) {
   document.body.style.fontSize=num;
}

function processPrevious(trgt,inc)
{if (document.images && thisPic > 0) {
thisPic--
document.myPicture.src=myPix[thisPic]
changeSize(document.body.style.fontSize-1);
if (document.body.style.fontSize<1) {
   document.body.style.fontSize=18;
}

if (!document.getElementById) return
var d = document,cEl = null,i,j,cTags;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
}
function processNext(trgt,inc)
{
if (document.images && thisPic < imgCt) {
thisPic++
document.myPicture.src=myPix[thisPic]

changeSize(document.body.style.fontSize+1) {
if (document.body.style.fontSize>18) {
   document.body.style.fontSize=1;
}

if (!document.getElementById) return
var d = document,cEl = null,i,j,cTags;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
}

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');
//---------->
</SCRIPT>
<style type="text/css">
<!--
body{font-size:18px;}
-->
</style>
</head>
<body>
<table width="329" border="0">
<tr>
<td width="117" align="right">Change font size</td>
<td width="48" align="right"><A HREF="javascript:processPrevious('body',-1)"><IMG SRC="arrows/reverse.gif" width="40" height="20" BORDER=0></a></td>
<td width="98" align="center"><IMG SRC="dots/digital4.gif" NAME="myPicture" width="81" height="20"></td>
<td width="48" align="left"><A HREF="javascript:processNext('body',1)"><IMG SRC="arrows/forward.gif" width="40" height="20" BORDER=0></a></td>
</tr>
</table>
<div>This is body text</div>
<div>This is body text</div>
</body>
</html>
0
 

Author Comment

by:mingchih
ID: 12210696
mm, not working...... also, can you make two different font size to change at same time ? thanks
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210704
Well, we should work on one part at a time. You're clicking on the links right?
0
 

Author Comment

by:mingchih
ID: 12210706
Do you think it is possible to add second  var szs = new Array( '11px','12px','13px','14px','15px','16px','17px' ); for another font size ??
0
 

Author Comment

by:mingchih
ID: 12210708
yes, click on the right image ( reverse.gif ) -- Font will getting larger. Click on the left image ( foward.gif ) -- font will getting smaller
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:mingchih
ID: 12210714
sorry, foward.gif is getting larger and reverse.gif is getting smaller
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210716
It should work. Try some debugging. Change the function:

function changeSize(num) {
   document.body.style.fontSize=num;
   alert(document.body.style.fontSize);
}
0
 

Author Comment

by:mingchih
ID: 12210725
I put it on the last script you post.....
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210729
Did anything happen?
0
 

Author Comment

by:mingchih
ID: 12210741
mm, no, but there is some error script
Expected ";" in

changeSize(document.body.style.fontSize+1) {
if (document.body.style.fontSize>18) {
document.body.style.fontSize=1;
}
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210744
Ah, make it this:

changeSize(document.body.style.fontSize+1);
if (document.body.style.fontSize>18) {
   document.body.style.fontSize=1;
}

What I meant above was to change the function changeSize
0
 

Author Comment

by:mingchih
ID: 12210755
oh, i am not saying that you are wrong, it is what browser said....i click on the little yellow sign....
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210759
Yes, I know. Are you putting the alert inside the function?
0
 

Author Comment

by:mingchih
ID: 12210766
ok, there is new one coming up....it said Object required in

myPix = new Array("dots/digital1.gif","dots/digital2.gif","dots/digital3.gif","dots/digital4.gif","dots/digital5.gif","dots/digital6.gif","dots/digital7.gif")
0
 

Author Comment

by:mingchih
ID: 12210770
yes, I put alarm....nothing show up...

function changeSize(num) {
document.body.style.fontSize=num;
alert(document.body.style.fontSize);
}
0
 

Author Comment

by:mingchih
ID: 12210772
alert,....
0
 

Author Comment

by:mingchih
ID: 12210782
ok, another error show up....
1. when I click on the forward.gif, it said " thisPic" is undefined in
if (document.images && thisPic < imgCt) {
thisPic++
document.myPicture.src=myPix[thisPic]

 and
 " thisPic" is undefined in
{if (document.images && thisPic > 0) {
thisPic--
document.myPicture.src=myPix[thisPic]
changeSize(document.body.style.fontSize-1);
if (document.body.style.fontSize<1) {
document.body.style.fontSize=18;
}
0
 

Author Comment

by:mingchih
ID: 12210829
this is overall script:

<html>
<head>
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers
startSz = document.body.style.fontSize
myPix = new Array("dots/digital1.gif","dots/digital2.gif","dots/digital3.gif","dots/digital4.gif","dots/digital5.gif","dots/digital6.gif","dots/digital7.gif")
thisPic = 3
imgCt = myPix.length -1

function changeSize(num) {
document.body.style.fontSize=num;
alert(document.body.style.fontSize);
}

function processPrevious(trgt,inc)
{if (document.images && thisPic > 0) {
thisPic--
document.myPicture.src=myPix[thisPic]
changeSize(document.body.style.fontSize-1);
if (document.body.style.fontSize<1) {
document.body.style.fontSize=18;
}

if (!document.getElementById) return
var d = document,cEl = null,i,j,cTags;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
}

function processNext(trgt,inc)
{if (document.images && thisPic < imgCt) {
thisPic++
document.myPicture.src=myPix[thisPic]
changeSize(document.body.style.fontSize+1);
if (document.body.style.fontSize>18) {
document.body.style.fontSize=1;
}

if (!document.getElementById) return
var d = document,cEl = null,i,j,cTags;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
}

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');
//---------->
</SCRIPT>
<style type="text/css">
<!--
body{font-size:18px;}
-->
</style>
</head>
<body>
<table width="329" border="0">
<tr>
<td width="117" align="right">Change font size</td>
<td width="48" align="right"><A HREF="javascript:processPrevious('body',-1)"><IMG SRC="arrows/reverse.gif" width="40" height="20" BORDER=0></a></td>
<td width="98" align="center"><IMG SRC="dots/digital4.gif" NAME="myPicture" width="81" height="20"></td>
<td width="48" align="left"><A HREF="javascript:processNext('body',1)"><IMG SRC="arrows/forward.gif" width="40" height="20" BORDER=0></a></td>
</tr>
</table>
<div>This is body text</div>
<div>This is body text</div>
</body>
</html>
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210848
Then it's your image changing script. Here's a simple script demonstrationg font changing:

<html>
<head>
<title>Font Size Changer</title>
<script language="javascript">
<!--

function changeSize(sz,end) {
   if (!end) {end="px";}
   document.body.style.fontSize=sz+"."+end;
}

//-->
</script>
<style type="text/css">
body {font-size:14pt;}     /* Here, I'm using pt to demonstrate the changeSize function end portion */
</style>
</head>
<body>
<a href="#" onclick="changeSize(14);">Change to 14PX</a> | <a href="#" onclick="changeSize(14,'pt');">Change to 14PT</a> | <a href="#" onclick="changeSize(4,'em');">Change to 4EM</a><br>
<input type="text" id="nsz" size="10" value="Number">.<input type="text" id="nend" size="3" value="End">&nbsp;
<input type="button" value="Change Font!" onclick="changeSize(document.getElementById('nsz').value,document.getElementById('nend').value);"><br><br><br>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam vitae ante. Curabitur eu lorem a libero hendrerit sollicitudin. Curabitur quis purus eget risus consectetuer luctus. Suspendisse wisi elit, commodo quis, euismod vitae, mollis dictum, pede. Aliquam massa erat, porttitor vel, vestibulum ac, faucibus ac, mauris. Sed odio urna, vulputate mattis, nonummy ac, auctor eget, lectus. Suspendisse pede. Fusce malesuada, sapien vel euismod semper, pede justo pulvinar mi, et tempus diam eros ut leo. Sed nibh leo, ornare nec, ullamcorper vitae, venenatis quis, urna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nulla ornare dignissim nunc. Donec ullamcorper, mi nec tincidunt gravida, nulla est euismod metus, dapibus tincidunt erat sem non ante. Proin tempor elit quis urna. Maecenas lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed turpis sem, pulvinar a, auctor ut, porttitor vel, justo. Donec tempor wisi eget est. Suspendisse faucibus eros a purus. Proin vel lectus eu magna commodo consectetuer.
</body>
</html>
0
 

Author Comment

by:mingchih
ID: 12210994
so, is there are any way that change my original script ? thanks
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12210998
You're original code is a bit confusing. It's not mainly the font changing code as the image cycling code. I would probably rewrite it
0
 

Author Comment

by:mingchih
ID: 12211041
Could you kindly show me the re-write version ? thanks
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 12211048
About the image cycling part: couldn't you use an animated gif89a instead?
What about this one for the css part:
<style type="text/css">
body.f12 {font-size:12px;}
body.f14 {font-size:14px;}
body.f16 {font-size:16px;}
body.f18 {font-size:18px;}
</style>
<body class="f14">
<a href="#" onclick="document.body.className='f12';return false;">Font size 12</a>
<a href="#" onclick="document.body.className='f14';return false;">Font size 14</a>
<a href="#" onclick="document.body.className='f16';return false;">Font size 16</a>
<a href="#" onclick="document.body.className='f18';return false;">Font size 18</a>
</body>
0
 
LVL 11

Expert Comment

by:raj3060
ID: 12212200
Ever thought of using css to make life easier. You will be writing tons of javaScript to do something which you can do with one line of CSS.
-Raj
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now