Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically set text size 1

Status
Not open for further replies.

tchaplin

Programmer
Jul 18, 2003
58
NZ
The problem that I’m having is that I want to be able to click on a button to make certain font text get larger. I’ve accomplished this with “the This Is Paragraph Two” statement however can’t achieve this within the table any ideas would be appreciated

<html>

<head>
<title>Font Size</title>
<script LANGUAGE=&quot;VBScript&quot;>
<!--


sub bttnTextSize_Onclick

if document.frmTextSize.bttnTextSize.value = &quot;Small Text&quot; then
document.frmTextSize.bttnTextSize.value = &quot;Large Text&quot;
document.body.style.fontSize = &quot;12&quot;
else
document.frmTextSize.bttnTextSize.value = &quot;Small Text&quot;
document.body.style.fontSize = &quot;26&quot;
end if
end sub


-->
</script>


</head>

<body>

<p><font face=&quot;Arial&quot; size=&quot;6&quot;><strong>This Is Title One</strong></font></p>

<p>This Is Paragraph One </p>

<p>&nbsp;</p>

<p><font size=&quot;7&quot;>This Is Tiltle Two</font></p>

<p>This Is Paragraph Two</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<table>
<tr>
<td width=&quot;100%&quot;>dfgfdgdffg</td>
</tr>
</table>

<form method=&quot;POST&quot; name=&quot;frmTextSize&quot;>
<p><input type=&quot;button&quot; value=&quot;Small Text&quot; name=&quot;bttnTextSize&quot;></p>
</form>
</body>
</html>

Thanks Todd
 
Code:
<html>

<head>
<title>Font Size</title>
<style>
.variableText {font-size:12;}
</style>
<script> 
<!--
 function changetext(){
  if(parseInt(document.styleSheets[0].rules[0].style.fontSize) == 12){
    document.styleSheets[0].rules[0].style.fontSize = '26px';
  }
  else{
    document.styleSheets[0].rules[0].style.fontSize = '12px';
  }
 }
//-->
</script>


</head>

<body>

<p><font face=&quot;Arial&quot; size=&quot;6&quot;><strong>This Is Title One</strong></font></p>

<p class=&quot;variableText&quot;>This Is Paragraph One </p>

<p> </p>

<p><font size=&quot;7&quot;>This Is Tiltle Two</font></p>

<p class=&quot;variableText&quot;>This Is Paragraph Two</p>

<p> </p>

<p> </p>

<table>
  <tr>
    <td class=&quot;variableText&quot; width=&quot;100%&quot;>dfgfdgdffg</td>
  </tr>
</table>

<form method=&quot;POST&quot; name=&quot;frmTextSize&quot;>
  <p><input type=&quot;button&quot; value=&quot;Small Text&quot; name=&quot;bttnTextSize&quot; onClick=&quot;changetext()&quot;></p>
</form>
</body>
</html>
 
Thanks for your speedy reply. New and still learning - Ive never heard of 'rules' will look that up thanks onjce again Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top