/    Sign up×
Community /Pin to ProfileBookmark

<DIV> resizing with Variables

So I got this <DIV>:

[CODE]<DIV style=”position:absolute;width:188px;height:16px;z-index:4″ align=”left”>
<FONT style=”FONT-SIZE:10pt” color=”#000000″ face=”Arial”>Concurs 1</FONT></DIV>[/CODE]

Now, I also have this script:

[CODE]<SCRIPT language=”JavaScript” type=”text/javascript”><!–
var X = 500;
var Y = 500;
function Smaller() {
X = 200;
Y = 200;
}
function Normal() {
X = 500;
Y = 500;
}
//–></SCRIPT>[/CODE]

Now, what I want to do, is to make the width from the DIV to be X and the height from the DIV to be Y, so I can assign certain buttons in the site with the Normal()/Smaller() functions.
I want it in the end to be smthing like this (of course, this is wrong:

[CODE]<DIV style=”position:absolute;width:Xpx;height:Ypx;z-index:4″ align=”left”>
<FONT style=”FONT-SIZE:10pt” color=”#000000″ face=”Arial”>Concurs 1</FONT></DIV>[/CODE]

How can I do that?
Also, I wanna do smthing like this for changing the text’s size, so tell me how to do that one too.

Thank you in advance

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@mrhooDec 05.2007 — Don't use the (deprecated) FONT element.

Assign to the element's style.width and style.height properties, and append the units- probably 'px'.
×

Success!

Help @JCD37 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...