Hi,
I have a little problem, i'm writing a large table with
lots of signals inside each cell and i made intensive use
of DIV tags with style='position:relative;' for correct
positioning.
It works fine in IE and FireFox (with adjustements), but
NS6, NS7 and Mozilla seem to render things differently.
Here's the full code (exepts the two bitmaps, but any one
can fit), if someone is patient enought to read and try it,
...
thank you
I have a little problem, i'm writing a large table with
lots of signals inside each cell and i made intensive use
of DIV tags with style='position:relative;' for correct
positioning.
It works fine in IE and FireFox (with adjustements), but
NS6, NS7 and Mozilla seem to render things differently.
Here's the full code (exepts the two bitmaps, but any one
can fit), if someone is patient enought to read and try it,
...
thank you
Code:
//============================
//===== CODE STARTS HERE =====
//============================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<TITLE>Test multi-DIV</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<HEAD>
<!------- STYLES ------->
<style>
td#valeur-synops {
border-right-width: 1px;
border-right-style: dotted;
border-right-color: #CCCCCC;
}
td#affichage-col-legende {
text-align: right;
padding-top: 2px;
padding-right: 4px;
padding-bottom: 2px;
padding-left: 2px;
}
.dek {
position:absolute;
visibility:hidden;
z-index:2000;
}
.lignenoire {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #000000;
}
.colonnenoire {
border-right-width: 1px;
border-right-style: solid;
border-right-color: #000000;
}
</style>
<!------- JAVASCRIPTS ------->
<script>
var msie5x = false;
var msie6x = false;
var ns4x = false;
var ns6x = false;
var ns7x = false;
var ff0x = false;
var mz1x = false;
var plateformeWin = false;
var plateformeMac = false;
var Xoffset = 0; // modify these values to ...
var Yoffset = 12; // change the popup position.
var yyy = 0;
var navName = navigator.appName;
var navVersion = navigator.appVersion;
var navUserAgent = navigator.userAgent;
var msgVersionInvalide = "Unsupported browser version.";
//--------------------------------------------------------------------------------------
function setBrowserVersion () {
msie5x = false;
msie6x = false;
ns4x = false;
ns6x = false;
ns7x = false;
ff0x = false;
mz1x = false;
plateformeWin = false;
plateformeMac = false;
Xoffset= 15; // modify these values to ...
Yoffset= 10; // change the popup position.
navName = navigator.appName;
navVersion = navigator.appVersion;
navUserAgent = navigator.userAgent;
/*----- Microsoft Internet Explorer 5.x -----*/
if (navName.indexOf("Microsoft") >= 0 && navVersion.indexOf("MSIE 5.") >= 0) {
msie5x = true;
}
/*----- Microsoft Internet Explorer 6.x -----*/
if (navName.indexOf("Microsoft") >= 0 && navVersion.indexOf("MSIE 6.") >= 0) {
msie6x = true;
}
/*----- NetScape 4.x -----*/
if (navName.indexOf("Netscape") >= 0 && navVersion.indexOf("4.") == 0) {
ns4x = true;
}
/*----- NetScape 6.x -----*/
if (navUserAgent.indexOf("Netscape6/6.") >= 0) {
ns6x = true;
}
/*----- NetScape 7.x -----*/
if (navUserAgent.indexOf("Netscape/7.") >= 0) {
ns7x = true;
}
/*----- NetScape FireFox1.x -----*/
if (navUserAgent.indexOf("Firefox/0.") >= 0) {
ff0x = true;
}
/*----- Mozilla 1.x -----*/
if (navUserAgent.indexOf("Gecko/") >= 0) {
mz1x = true;
}
/*----- Windows -----*/
if (navVersion.indexOf ("Win") >=0) {
plateformeWin = true;
/*----- Macintosh -----*/
} else if (navVersion.indexOf ("Mac") >=0) {
plateformeWin = true;
/*----- Inconnu -----*/
} else {
alert (msgVersionInvalide + " : " + navVersion);
}
}
//--------------------------------------------------------------------------------------
function showBrowserVersion () {
alert (navigator.appName + "\n" + navVersion + "\n" + navUserAgent);
alert ("Is it ? \nIE 5.x : " + msie5x + " \n IE 6.x : " + msie6x + "\n NS 4.x : " + ns4x + "\n NS 6.x : " + ns6x + "\n NS 7.x : " + ns7x + "\n Firefox 0.x : " + ff0x + "\nMozilla 1.x : " + mz1x);
}
//--------------------------------------------------------------------------------------
function popup(msg,bak) {
setBrowserVersion();
document.onmousemove=get_mouse;
var content="<TABLE WIDTH=150 BORDER=1 BORDERCOLOR=gray CELLPADDING=2 CELLSPACING=0 BGCOLOR="+bak+"><TD ALIGN=center nowrap><FONT COLOR=black SIZE=2>"+unescape(msg)+"</FONT></TD></TABLE>";
yyy = Yoffset;
document.getElementById("dek").innerHTML=content;
document.getElementById("dek").style.display='';
document.getElementById("dek").style.visibility = "visible";
document.getElementById("dek").style.left=-1000;
}
//--------------------------------------------------------------------------------------
function get_mouse(e){
setBrowserVersion();
var x=(ns4x||ns6x)?e.pageX:event.clientX+document.body.scrollLeft;
var y=(ns4x||ns6x)?e.pageY:event.clientY+document.body.scrollTop;
larg = document.getElementById("dek").offsetWidth;
haut = document.getElementById("dek").offsetHeight;
if (x + larg > getWindowWidth() - 210) x = getWindowWidth() - larg - 210;
document.getElementById("dek").style.left=x+Xoffset;
document.getElementById("dek").style.top=y+Yoffset;
}
//--------------------------------------------------------------------------------------
function kill(){
setBrowserVersion();
yyy=-1000;
if(ns4x){
document.dek.visibility="hidden";
} else if (ns6x||msie6x) {
document.getElementById("dek").style.display="none";
document.getElementById("dek").style.visibility = "hidden";
} else if (msie5x) {
document.all.dek.style.display="none";
document.all("dek").style.visibility = "hidden";
}
}
//--------------------------------------------------------------------------------------
function getWindowWidth () {
return screen.availWidth;
}
</script>
</HEAD>
<!------- BODY ------->
<BODY>
Hi !<br>
as you can see, this table must show 3 cells (1 row per 3 columns) : <br>
first line title, then 1 cell showing 2 bitmaps (gif images 2x2 pixels stretched) <br>
and 4 numbers positionned at each corner of cell. This is done by using DIV tags and <br>
repositioning by style property.<br>
Annoying is that behavior is not the same under MSIE, NS6.x, NS7.x and FireFox<br>
Try it and see ... <br>
Any idea ?
<!--===== Popup DIV =====-->
<DIV id="dek" class="dek"> </DIV>
<script>
var posAx = 0;
var posBx = 0;
var posCx = 10;
var posDx = 10;
var posAy = -24;
var posBy = -14;
var posCy = -22;
var posDy = -12;
var shiftY = 13;
var decNS6 = 5;
var decFF0 = 5;
</script>
<!--===== THE TABLE =====-->
<TABLE border="0" cellspacing="0" cellpadding="1 " style="table-layout:fixed">
<!------ LINE 1 ------>
<TR height="20px">
<TD width="128px" height="20px" class="colonnenoire" id="affichage-col-legende">Line 1 </TD>
<!------ COL 1 ------>
<TD class="lignenoire" id="valeur-synops" width="22px" height="20px">
<!-- Please pay attention : closing tag next line to force two bitmaps show glued-->
<img src='code_couleur_14.gif' width='9px' height='17px' border='0' onmouseover='javascript:popup("GIF 1","#FFFFD6")' onmouseout='javascript:kill()'
><img src='code_couleur_15.gif' width='9px' height='17px' border='0' onmouseover='javascript:popup("GIF 2","#FFFFD6")' onmouseout='javascript:kill()'>
<script>
setBrowserVersion();
posxLoc = posAx;
posyLoc = posAy;
if (ff0x) {
posyLoc += decFF0;
} else if (msie5x || msie6x) {
posyLoc -= shiftY * 0;
} else if (ns6x || ns7x) {
posyLoc += decNS6 - shiftY * 0;
} else {
}
document.write("<DIV style='position:relative;left:" + posxLoc + "px;top:"+ posyLoc + "px;width:0px;height:0px;'>");
</script>
<A href='#' onmouseover='javascript:popup("Texte infobulle 1","#FFFFD6")' onmouseout='javascript:kill()' style='cursor:pointer;text-decoration:none'>
<FONT style='font-size:7pt;color:#100000;'>
1
</FONT>
</A>
</DIV>
<script>
posxLoc = posBx;
posyLoc = posBy;
if (ff0x) {
posyLoc += decFF0 - 1;
} else if (msie5x || msie6x) {
posyLoc -= shiftY * 1;
} else if (ns6x || ns7x) {
posyLoc += decNS6 - shiftY * 1;
} else {
}
document.write("<DIV style='position:relative;left:" + posxLoc + "px;top:"+ posyLoc + "px;width:0px;height:0px;'>");
</script>
<A href='#' onmouseover='javascript:popup("Texte infobulle 2","#FFFFD6")' onmouseout='javascript:kill()' style='cursor:pointer;text-decoration:none'>
<FONT style='font-size:7pt;color:#100000;'>
2
</FONT>
</A>
</DIV>
<script>
posxLoc = posCx;
posyLoc = posCy;
if (ff0x) {
posyLoc += decFF0 - 2;
} else if (msie5x || msie6x) {
posyLoc -= shiftY * 2;
} else if (ns6x || ns7x) {
posyLoc += decNS6 - shiftY * 2;
} else {
}
document.write("<DIV style='position:relative;left:" + posxLoc + "px;top:"+ posyLoc + "px;width:0px;height:0px;'>");
</script>
<A href='#' onmouseover='javascript:popup("Texte infobulle 3","#FFFFD6")' onmouseout='javascript:kill()' style='cursor:pointer;text-decoration:none'>
<FONT style='font-size:7pt;color:#100000;'>
3
</FONT>
</A>
</DIV>
<script>
posxLoc = posDx;
posyLoc = posDy;
if (ff0x) {
posyLoc += decFF0 - 3;
} else if (msie5x || msie6x) {
posyLoc -= shiftY * 3;
} else if (ns6x || ns7x) {
posyLoc += decNS6 - shiftY * 3;
} else {
}
document.write("<DIV style='position:relative;left:" + posxLoc + "px;top:"+ posyLoc + "px;width:0px;height:0px;'>");
</script>
<A href='#' onmouseover='javascript:popup("Texte infobulle 4","#FFFFD6")' onmouseout='javascript:kill()' style='cursor:pointer;text-decoration:none'>
<FONT style='font-size:7pt;color:#100000;'>
4
</FONT>
</A>
</DIV>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>