/    Sign up×
Community /Pin to ProfileBookmark

NN and IE Layer repositioning (style.left) help!!!!

hi
Have been developing a javascript menu with 1 sub menu. The main part of the menu is in a DIV tag within a table so it is in the correct position however the submenu is another floating layer using a DIV tag and style.left to position it. The following functions show how it is displayed and positioned.
After changing the getObj function to work with netscape all was fine in both IE and NN. However another function written that repositions the submenu layer (the 2nd DIV tag) according to browser dimensions fails to work in NN but is still fine in IE. As can be seen the style.visibility property seems to work fine for both browsers however the style.left property doesnt seem to be able to be written to in NN. Where am i going wrong with this? As can be seen i have tried an alternate method that is commented out but still no luck in NN all i get when the property is viewed is the original position of 150px in the style.left attribute.
Can someone help i have been stuck on this for a while and would like it working nicely and correctly in as many browsers as possible. Also would most appreciate if someone could explain the differences to make this compatible in opera as the submenu layer needs to be able to open accross an iframe.
Thanks for any help

Nick Ford

/* Set of functions that handle the operation of a menu consisting of 2 layers
*
Written by Nicholas Ford [email][email protected][/email]
*/

/* Browser type and menu timer variables */
var isNetscape = (navigator.appName == “Netscape”);
var timer;

/* This gets the layer object passed according to browser type */
function getObj(obj) {
if(isNetscape) {
retLayer = document.getElementById(obj).style;
//retLayer = document.layers[obj];
}else {
retLayer = eval(“document.all.” + obj + “.style”);
}
return retLayer;
}

/* Makes the passed layer visible */
function show(layer) {
obj = getObj(layer);
obj.visibility = “visible”;
}

/* Hides the passed layer */
function hide(layer) {
obj = getObj(layer);
obj.visibility = “hidden”;
}

/* Find the availble width of the browser content window */
function getScreenWidth() {
available = (isNetscape) ? window.innerWidth : document.body.clientWidth;
return available;
}

/* Show or hide the submenu according to true or false passed */
function menuRoll(status) {
if (status) {
show(“submenu0”);
}else {
hide(“submenu0”);
}
}

/* Reposition the submenu on the page according to the size of the window */
function repositionMenu(isResize) {
obj = getObj(“submenu0”);
curW = getScreenWidth();

if(curW > 800) {
/*Half the browser width finds the centre of the page – half the page layout + the offset*/
newL = (curW/2 – 360) + 140;
obj.left = newL;
//document.getElementById(“submenu”).left = newL
}else {
obj.left = 150;
}
}

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [font=arial][color=maroon]Perhaps you should try:[/color][/font]

[font=courier new]

if(curW > 800) {

/*Half the browser width finds the centre of the page - half the page layout + the offset*/

newL = (curW/2 - 360) + 140;

obj.left = newL[b]+"px";[/b]

//document.getElementById("submenu").left = newL[b]+"px";[/b]

}else {

obj.left = 150[b]+"px"[/b];

}

}

[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@MatthewkiJan 21.2015 — [url=http://saufronlasib.ddns.net/kupit-italyanskoe-rozovoe-soblaznitelnoe-zhenskoe-nizhnee-bele-hanty-mansiysk.html]купить итальянское розовое соблазнительное женское нижнее белье Ханты-Мансийск[/url] [url=http://parkfitzsporer.ddns.net/kupit-fioletovoe-erotichnoe-bele-sankt-peterburg.html]купить фиолетовое эротичное белье Санкт-Петербург[/url] [url=http://rmonrapamett.ddns.net/internet-magazin-italyanskoe-zelenoe-atlasnoe-nizhnee-bele-syktyvkar.html]интернет магазин итальянское зеленое атласное нижнее белье Сыктывкар[/url] [url=http://manloiriglia.ddns.net/kupit-krasnoe-bele-astrahan.html]купить красное белье Астрахань[/url] [url=http://tranrabetlay.ddns.net/internet-magazin-italyanskoe-beloe-soblaznitelnoe-zhenskoe-nizhnee-bele-magas.html]интернет магазин итальянское белое соблазнительное женское нижнее белье Магас[/url] [url=http://cernacolli.ddns.net/tureckoe-sinee-kruzhevnoe-zhenskoe-bele-gorno-altaysk.html]турецкое синее кружевное женское белье Горно-Алтайск[/url] [url=http://heirasanes.ddns.net/angliyskoe-rozovoe-erotichnoe-zhenskoe-nizhnee-bele-vladikavkaz.html]английское розовое эротичное женское нижнее белье Владикавказ[/url] [url=http://parthinridis.ddns.net/tureckoe-eroticheskoe-bele-novgorod.html]турецкое эротическое белье Новгород[/url] [url=http://prolgiotobe.ddns.net/kupit-belorusskoe-sinee-erotichnoe-zhenskoe-nizhnee-bele-tambov.html]купить белорусское синее эротичное женское нижнее белье Тамбов[/url] [url=http://naphseipira.ddns.net/internet-magazin-zelenoe-erotichnoe-nizhnee-bele-kostroma.html]интернет магазин зеленое эротичное нижнее белье Кострома[/url] [url=http://tarocintpi.ddns.net/rozovoe-kruzhevnoe-bele-saransk.html]розовое кружевное белье Саранск[/url] [url=http://calandstatof.ddns.net/internet-magazin-angliyskoe-zelenoe-eroticheskoe-bele-omsk.html]интернет магазин английское зеленое эротическое белье Омск[/url] [url=http://glycbelwildlas.ddns.net/kupit-angliyskoe-rozovoe-soblaznitelnoe-bele-naryan-mar.html]купить английское розовое соблазнительное белье Нарьян-Мар[/url] [url=http://spireracra.ddns.net/kupit-italyanskoe-fioletovoe-atlasnoe-bele-stavropol.html]купить итальянское фиолетовое атласное белье Ставрополь[/url] [url=http://eddedasa.ddns.net/kupit-tureckoe-seksualnoe-nizhnee-bele-ulan-ude.html]купить турецкое сексуальное нижнее белье Улан-Удэ[/url] [url=http://catssuracge.ddns.net/angliyskoe-krasnoe-azhurnoe-nizhnee-bele-magas.html]английское красное ажурное нижнее белье Магас[/url] [url=http://glycbelwildlas.ddns.net/fioletovoe-azhurnoe-zhenskoe-nizhnee-bele-gorno-altaysk.html]фиолетовое ажурное женское нижнее белье Горно-Алтайск[/url] [url=http://ahanapri.ddns.net/kupit-rozovoe-seksualnoe-bele-vladivostok.html]купить розовое сексуальное белье Владивосток[/url]
Copy linkTweet thisAlerts:
@Troy_IIIJan 21.2015 — you must be kidding nisgar2k
Copy linkTweet thisAlerts:
@Kevin2Jan 22.2015 — Ummmm. Did anyone recently responding look at the dates of the original thread? [B]nisgar2k[/B]'s post is dated 1 July, [B][I][COLOR="#FF0000"][SIZE=5]2003[/SIZE][/COLOR][/I][/B]. [B]Matthewki[/B]'s post from earlier today seems to be full of a bunch of spam links.
Copy linkTweet thisAlerts:
@Troy_IIIJan 22.2015 — Even than (2003) this question was antique! ?

Thanks Kevin2.

Every now and than skeletons are brought up when people dig for ready to use scripts and might even end up checking if browser supports IMG tags.

So, "no" - I'm used to this kind of stuff ?
×

Success!

Help @nisgar2k 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.1,
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,
)...