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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing font size in a <DIV> span 2

Status
Not open for further replies.

N3XuS

Programmer
Joined
Mar 1, 2002
Messages
339
Location
BE
I can't seem to change the font size from my text in the DIV span with javascript.
I tried a funtion like
function swell(t) {
t.style.fontsize("50");
}
but my text has to be in a string for that.
No idea how to work with the strings either ...
a document.write just replaces everything else on the website ...
 
hi,
use span for this. define two classes. one with a small font, one with a large fond. now try this:
Code:
<span class=&quot;smallfont&quot; id=&quot;asd&quot; onmouseover=&quot;ChangeFont(this)&quot;>Text Here</span>
<script>
function ChangeFont(cls)
{
 cls.className=&quot;bigfont&quot;
}
</script>

Known is handfull, Unknown is worldfull
 
Good morning kris :)
Trying it out right away
 
works fine :) thx man.
So there's no real text objects I can do nice things with ?
So I could write some animations for text.
 
Or, to fix your original, change it to
Code:
t.style.fontSize = &quot;50&quot;;
.

The way you were doing it, it was trying to call a function called
Code:
fontsize()
and pass the value of 50, rather than set the
Code:
fontSize
to 50.
 
Weird it works :)
Thought I tried that. thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top