A Conversation for The H2G2 Programmers' Corner

Webbrowser Problems,

Post 1

DoctorMO (Keeper of the Computer, Guru, Community Artist)

A JavaScript/CSS Problem here,

I've made a menu system, to get it to work in NS6 and IE5.0 I had to do quite a lot of jiggery pokery, none of the versions had the same seting and getting for positioning of elements, let alone the getting of the objects them selves (this problem was solved with the replacing of getElementById with some if's for layers and all) now I've come to the conclusion that either I'm going to have to saunter down the HTML tree untill I reach the root or display everything at the top left of the screen. is there no way to ask it for true dimentions?

using DIV tags, with CSS styles.


Webbrowser Problems,

Post 2

Pastey

Off the top of my head, you use a javascript function to get the screen size, this has to take account of the different browsers, and then assign the values to variables, x and y, you then use these.

CSS can also set them selves from the bottom right aswell.

smiley - rose


Webbrowser Problems,

Post 3

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Why would I need the screen area or scroll area?

-- DoctorMO --


Webbrowser Problems,

Post 4

Pastey

Have you got this up anywhere?

getting the screen/window size allows you to place exactly per pixel the elements on the page.
if you want it fluid, use percentages.

smiley - rose


Webbrowser Problems,

Post 5

DoctorMO (Keeper of the Computer, Guru, Community Artist)

I did have a problem setting the positions but I seem to solve that with some research into the way they behave, it's getting the damb current values without setting any (because of text flow).

http://www.infranet-partners.com/cgi-bin/index.pm

give me a min, to upload the latest version.

-- DoctorMO --


Webbrowser Problems,

Post 6

DoctorMO (Keeper of the Computer, Guru, Community Artist)

That should do it.

-- DoctorMO --


Webbrowser Problems,

Post 7

Pastey

So what doesn't it do that you want it to?

smiley - rose


Webbrowser Problems,

Post 8

DoctorMO (Keeper of the Computer, Guru, Community Artist)

it's fudged at the moment, I got a load of if NS +10px and if else -5px, it's just not right and then I got a realy sticky table traverse for one of the dimentions in were I go though it with Id's, I can't use these because there not apart of the script and it makes it realy inflexable!

-- DoctorMO --


Webbrowser Problems,

Post 9

Pastey

Instead of using px to set exact pixels, why not try % to give it a percentage? Flows easier that way.
Failing that what about the..
style="position:absolute; top:10px left:10px"
attribute. Of course, you can use your own figures smiley - winkeye

smiley - rose


Webbrowser Problems,

Post 10

C Hawke

Not sure if this helps in anyway, but the JS routine that MM Fireworks uses (copyright free, see notes at top) to do menus can be found on my site here [Unsuitable link removed by Moderator]- any of the html pages on my site show how it is invoked.

CH


Webbrowser Problems,

Post 11

DoctorMO (Keeper of the Computer, Guru, Community Artist)

see, perfect way to SET position, but when it comes to GETing the position JavaScript's DOM falls to it's nees. Oh dear why did we have to move from simple Assembler? smiley - sadface

-- DoctorMO --


Key: Complain about this post