A
Adam Risser
Hi, I am writing a function to change the font-size but I am running
into a snag. I cannot get the current font-size of the body. Here is
a link to a simplified test case
http://mustang.millersville.edu/~wstudent/cewing/mu/test.php
You would think that it would alert 72.5% when you click the resize
button, but it alerts nothing. If i add the style to the body tag
(style="font-size: 72.5%;" ), then it works.
Here is the test case code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;
charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<script type="text/javascript">
function resizeText()
{
alert(document.getElementsByTagName('body')[0].style.fontSize);
}
</script>
<style type="text/css">
body {
background: transparent url('../img/bg_pattern.gif') repeat 0 0;
font-size: 72.5%;
font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif
}
</style>
</head>
<body>
<p>Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test</p>
<p>Text Resize <a href="#" id="grow"
onclick="resizeText()">A<sup>+</sup></a> </p>
</body>
</html>
Thanks in advance!
into a snag. I cannot get the current font-size of the body. Here is
a link to a simplified test case
http://mustang.millersville.edu/~wstudent/cewing/mu/test.php
You would think that it would alert 72.5% when you click the resize
button, but it alerts nothing. If i add the style to the body tag
(style="font-size: 72.5%;" ), then it works.
Here is the test case code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;
charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<script type="text/javascript">
function resizeText()
{
alert(document.getElementsByTagName('body')[0].style.fontSize);
}
</script>
<style type="text/css">
body {
background: transparent url('../img/bg_pattern.gif') repeat 0 0;
font-size: 72.5%;
font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif
}
</style>
</head>
<body>
<p>Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Test Test Test Test Test Test Test Test Test Test Test</p>
<p>Text Resize <a href="#" id="grow"
onclick="resizeText()">A<sup>+</sup></a> </p>
</body>
</html>
Thanks in advance!