ianv
07-31-2002, 09:43 AM
Hi
I am trying to use Javascript to center my page dynamically, I have come across some code but am unsure what it means, if anybody could decipher it I would be grateful as I am using this to get to grips with javascript.
TIA
in the <body>
<snippet>
<div style="position: absolute; left: 1; top: 0; height: 941; width: 781; id="logo">
external javascript file
---------------
t = navigator.appVersion;
if ((t.indexOf("Mac") != -1)){
u = t.indexOf('MSIE');
v = parseInt(t.substring(u + 5));
if (u != -1 && v >= 4){
document.write('<img src="/pix/dot.gif" height="3000" width="1" border="0">')
}
}
var screenWidth = 0;
if (document.all != null) {
screenWidth = document.body.offsetWidth - 765;
} else if ((navigator.appName == 'Netscape')) {
screenWidth = window.innerWidth - 765;
}
if (screenWidth >= 0) {
screenMargin = screenWidth / 2;
} else {
screenMargin = 0;
}
document.write('<div id="outer" style="position: absolute; left: ' + screenMargin + 'px; top: 5px; z-index: 1">');
window.defaultStatus = 'Intranet.net';
var BannerAdPrefix = ""
function VirginBannerClick(url){top.location = BannerAdPrefix + url}
function sendToAFriend() {
var pn = document.location.href;
window.open("/sendtoafriend/sendtoafriend.html?"
+ pn,"","toolbar=no,scrollbars=no,width=480,height=520,noresize");
}
I am trying to use Javascript to center my page dynamically, I have come across some code but am unsure what it means, if anybody could decipher it I would be grateful as I am using this to get to grips with javascript.
TIA
in the <body>
<snippet>
<div style="position: absolute; left: 1; top: 0; height: 941; width: 781; id="logo">
external javascript file
---------------
t = navigator.appVersion;
if ((t.indexOf("Mac") != -1)){
u = t.indexOf('MSIE');
v = parseInt(t.substring(u + 5));
if (u != -1 && v >= 4){
document.write('<img src="/pix/dot.gif" height="3000" width="1" border="0">')
}
}
var screenWidth = 0;
if (document.all != null) {
screenWidth = document.body.offsetWidth - 765;
} else if ((navigator.appName == 'Netscape')) {
screenWidth = window.innerWidth - 765;
}
if (screenWidth >= 0) {
screenMargin = screenWidth / 2;
} else {
screenMargin = 0;
}
document.write('<div id="outer" style="position: absolute; left: ' + screenMargin + 'px; top: 5px; z-index: 1">');
window.defaultStatus = 'Intranet.net';
var BannerAdPrefix = ""
function VirginBannerClick(url){top.location = BannerAdPrefix + url}
function sendToAFriend() {
var pn = document.location.href;
window.open("/sendtoafriend/sendtoafriend.html?"
+ pn,"","toolbar=no,scrollbars=no,width=480,height=520,noresize");
}