/    Sign up×
Community /Pin to ProfileBookmark

How to resize the height of a DIV in NS?

When I resize my window I’ll resize the height of a table and a div.
It works perfect in IE. Resizing the table works in NS but not the div. Do anyone knows how it works?
To resize the table works like this:

[CODE]
var x=document.getElementById(myTable).rows
x[0].style.height= y – 125;
[/CODE]

To resize the div in IE works it like this:

[CODE]
myDIV.style.pixelHeight = y – 125;
[/CODE]

Help! ?

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonNov 09.2004 — var x=document.getElementById(myTable).rows;
x[0].style.height = (y - 125) [color=red]+ px[/color];
Units. Always use the units, there is NO default unit to fall back on if one is not specified. Incidentally this method will also work in IE.
Copy linkTweet thisAlerts:
@amlauthorNov 10.2004 — Hi, and thanks for replying!

Yes, i know that i'll use units but this is not the problem. I have no problem to resize the table. The problem is to resize my DIV in NS... :rolleyes:
Copy linkTweet thisAlerts:
@KorNov 10.2004 — 
To resize the table works like this:

var x=document.getElementById(myTable).rows

x[0].style.height= y - 125;
[/quote]


To resize [b]whichever[/b] object (included a DIV) works the same...

var myDiv=document.getElementById(id);

myDiv.style.height=(y-125)+'px';

Should work in NS6+, Moz, as well in IE5+, Opera 5+ and so on.

Oh, if you mean [b]NS4[/b] than the reference is otherwise

var myDiv=document.layers[id];

myDiv.height =(y-125)+'px';
Copy linkTweet thisAlerts:
@David_HarrisonNov 10.2004 — [i]Originally posted by aml [/i]

[B]The problem is to resize my DIV in NS... :rolleyes:[/B][/QUOTE]
Then all you need to do is remove the table ID and insert the div ID. :rolleyes:
Copy linkTweet thisAlerts:
@TwasnowJan 29.2005 — The thing most people miss is the + 'px' it will work in IE without it but not Moz or NS, which is odd because the style sheet "height" works in Moz and NS without the px but not in IE.

Hey, as long as no one is consistant ?
×

Success!

Help @aml 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.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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