Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Automaticaly resize the font ? How?</title>
<script type="text/javascript">
function font_size()
{
var ranger = document.form_name.a.value;
var p1 = document.getElementById("p1");
var p3 = document.getElementById("p3");
p1.innerHTML = ranger + " Ako ay pogi";
document.form_name.x.value=ranger;
document.getElementById("p2").style.fontsize= ranger+"px";
document.getElementById("p3").style.fontSize="xx-large";
}
</script>
</head>
<body>
<p id="p1"> </p>
<br>
<p id="p2">dfdfdfdfdfdfdf</p>
<p id="p3" >dfgdfgdfgdfgdfgdfgdfg</p>
<br />
<form id="numform" name="form_name" method="post">0
<input type="range" name="a" max="30" id="rendz" onchange="font_size()"/>
<input type="text" form="numform" name="x" for="a" style=" width:15px;">
<br>
<button onchange="font_size()">Button for javascript output</button>
<input type="submit" name="ok" value="Button for PHP output" />
</form>
<center>
<?php
if(isset($_POST['ok'])){
$range=$_POST['a'];
echo'the range output : '.$range;
?>
<br>
<font size=" <?php echo $range; ?>px;">Resize text output for PHP</font>
<?php
}//end of isset
?>
<br><br>
</center>
</body>
</html>
Comment