Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<script language="JavaScript">
// FHS Tumblr Online Counter
var height = '56'; 
var fhs = document.createElement('script');var fhs_id = "5593850";
var ref = (''+document.referrer+'');var pn =  window.location;var w_h = window.screen.width + " x " + window.screen.height;
fhs.src = "//freehostedscripts.net/ocounter.php?site="+fhs_id+"&e1=Online User&e2=Online Users&r="+ref+"&wh="+w_h+"&a=1&pn="+pn+"&s=1&a=1&h=&h="+height+"";
document.head.appendChild(fhs);document.write("<span id='o_"+fhs_id+"'></span>");
</script>


What I have tried:

It change font size as you change size in html! Is it possible in script to change the font of the line and color?

document.getElementById("myP").style.fontSize = "small";
Posted
Updated 19-Apr-20 21:20pm
v2

1 solution

You can define a CSS class with font parameters to be applied, and apply that class programmatically to corresponding element.
CSS
.custom {
   font-family: Consolas, Courier, monospace;
   font-size: small;
}

JavaScript
document.getElementById("myP").className = "custom";
 
Share this answer
 
Comments
Mark Rene Jensen 20-Apr-20 19:01pm    
I tryed :) but the font is still big it must be something else wrong!
phil.o 20-Apr-20 19:28pm    
Check in the web console which styles are actually applied to the element. If several styles are applied, the last defined wins over previous ones.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900