Hi,
I would like to make two icons in my page so as to click on them and increase or decrease the font size of paragraph.
The problem I have is that I want to change the size only for a paragraph.
My paragraph's text is from a database.
So the id is different in each paragraph.
My code is :
<script type="text/javascript">
function resizeText(multiplier,p) {
if (document.getElementById(p).style.fontSize == "") {
document.getElementById(p).style.fontSize = "1.0em";
}
document.getElementById(p).style.fontSize = parseFloat(document.getElementById(p).style.fontSize) + (multiplier * 0.2) + "em";
}
</script>
$c=0; //counter for changing id name
//.... select from database
//......
while ($row = mysql_fetch_assoc($result))
{
$c = $c +1;
$text = ... // is from db
$p="par".$c;
echo "<p align='right'><img id='plustext' alt='Increase text size' src='images/ste.gif' width='19' height='29' onclick='resizeText(1,".$p.")'/></a>";
echo "<p align='justify' id='".$p."'>".$text."</p>";
}
But it doesn't work.
Any help ?
Thanks a lot