simple question

P

plemon

How can I change the size of the text in a variable i.e.
var hello = "hello there dreamy"

How can I change they font size to a fixed size i.e. 11pt or 26pt?

and How can I change it to match a CSS Style im using?

thanks, P. Lemon
 
L

Lee

plemon said:
How can I change the size of the text in a variable i.e.
var hello = "hello there dreamy"

That's a bit like saying that you want to change the flavor of a number.
Javascript strings don't have a font.
What is it that you really want to do?


--
 
T

Tim Slattery

plemon said:
How can I change the size of the text in a variable i.e.
var hello = "hello there dreamy"

How can I change they font size to a fixed size i.e. 11pt or 26pt?

Text in a Javascript variable has no size, it's just text. When you
write it to your page you can surround it with whatever formatting
tags you want.
 
R

Randy Webb

plemon said the following on 1/8/2007 3:52 PM:
How can I change the size of the text in a variable i.e.

There is no "size of text" in a variable. It is only when displayed that
it gains a "size".
var hello = "hello there dreamy"

How can I change they font size to a fixed size i.e. 11pt or 26pt?

How are you displaying it? If in an alert/confirm/prompt then you can't.
and How can I change it to match a CSS Style im using?

assign an element a class, define that class, and insert your text into
that element. Search the FAQ for DynWrite.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
How can I change the size of the text in a variable i.e.
var hello = "hello there dreamy"

How can I change they font size to a fixed size i.e. 11pt or 26pt?


Characters in a String are just Unicode characters; they do not have a
size, font, or colour. They are bit patterns, associated with some
expectation of their appearance on screen or paper - so
\u0392\u039F\u03A7 can be expected to look like BOX.

However, it is possible that your aims can be achieved by using these
methods of String : .big() .small() .fontsize(N) - however, N is not
points, but represents one of the Seven Sizes of HTML.


Changing to a fixed point size is liable to be in breach of Disability
Discrimination principles.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top