L
ladygrey
Guest
Hi all
Hope someone can help me here I am having trouble trying to resize the text on the page I am making ( First attempt with javascript ) I am using an external .js.
Below is my text.js
<!-- hide script from old browsers
var font_size = 14; var MAX = 17; var MIN = 11; function
adjust_text(num) { font_size += num; if(font_size > MAX) {
font_size = MAX; } if(font_size < MIN) { font_size = MIN; }
document.getElementsByTagName("body")[0].style.fontSize =
font_size + "px"; document.getElementById("test").style.fontSize
= (font_size + 3) + "px"; } adjust_text(0);
// end hiding script from old browsers -->
Below is the example page I am working on
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<!-- // hiding from older browsers
<script src="text.js" language="javascript" type=text/javascript">
// -->
</head>
<body>
<legend>Adjust font size</legend>
<form action="gotoLocation.cgi"><input type="button" value="down" onclick=
"adjust_text(-1)"> <input type="button" value="up" onclick=
"adjust_text(1)"></form>
<p>This is the body text</p>
<p id="test">This is the second body text</p>
<noscript>
<input type="submit"value="Go There!">
</noscript>
</body>
</html>
Any help is appreciated
Ladygrey
Hope someone can help me here I am having trouble trying to resize the text on the page I am making ( First attempt with javascript ) I am using an external .js.
Below is my text.js
<!-- hide script from old browsers
var font_size = 14; var MAX = 17; var MIN = 11; function
adjust_text(num) { font_size += num; if(font_size > MAX) {
font_size = MAX; } if(font_size < MIN) { font_size = MIN; }
document.getElementsByTagName("body")[0].style.fontSize =
font_size + "px"; document.getElementById("test").style.fontSize
= (font_size + 3) + "px"; } adjust_text(0);
// end hiding script from old browsers -->
Below is the example page I am working on
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<!-- // hiding from older browsers
<script src="text.js" language="javascript" type=text/javascript">
// -->
</head>
<body>
<legend>Adjust font size</legend>
<form action="gotoLocation.cgi"><input type="button" value="down" onclick=
"adjust_text(-1)"> <input type="button" value="up" onclick=
"adjust_text(1)"></form>
<p>This is the body text</p>
<p id="test">This is the second body text</p>
<noscript>
<input type="submit"value="Go There!">
</noscript>
</body>
</html>
Any help is appreciated
Ladygrey