
Originally Posted by
Chroniclemaster1
you may be on to something there, so it doesn't care about the numerics? It still does it when you deploy non-integer ids?
hmmmmm... is it following the order of the CSS definitions (what was .button1, .button2, etc.), or the order of the javascript functions (what was button1(), button2(), etc.)? Which determines the preference?
i did a through check, this happens in IE regardless of the following.
1. with or without numerics.
2. any order of declaration of javascript functions.
3. any order of declaration of CSS definitions.
At first i tried reversing the order (.button4, .button3.. so on)/(button4(), button().. so on) still no luck. I even tried completely randomizing the order. Still no chance.
it gives priority like so, to simplify I'll mention its colors.
green < red < blue < yellow.
in the bellow code i also changed the order of the input buttons as well, in addition to other changes.
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style>
p
{
margin: 0px;
padding: 0px;
}
body, html
{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
background-color: #e9e9e9;
}
form
{
margin: 0px;
padding: 0px;
}
.favBg
{
display: none;
border: 0px;
padding: 0px;
margin: 0px;
width: 100%;
position: absolute;
background-color: #000000;
opacity: 0.5;
filter: Alpha(opacity:50);
z-index: 999;
}
.favArea
{
display: none;
border-width: 1px;
border-style: solid;
border-color: #125717;
padding: 0px;
position: absolute;
background-color: white;
z-index: 1000;
}
.portfolio
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right:0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: red;
}
.contact
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: yellow;
}
.gallery
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right:0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: blue;
}
.support
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right:0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: green;
}
.infoMsg
{
padding-top: 10px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 10px;
margin-right: 10px;
font-family: Verdana, Arial, Tahoma;
font-weight: bolder;
font-size: 15px;
color: white;
letter-spacing: 0px;
position: relative;
}
.closeMsg
{
padding: 0px;
margin-top: 2px;
margin-bottom: 0px;
margin-left: 5px;
margin-right: 0px;
font-family: Verdana, Arial, Tahoma;
font-weight: none;
font-size: 12px;
color: black;
letter-spacing: 0px;
position: relative;
}
.buttons
{
border-width: 2px;
border-style: solid;
border-color: black;
padding: 0px;
margin-top: 80px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
</style>
<script>
function OffWindowHeight()
{
var OffWindowHeight=0;
window.scrollTo(0,10000000);
if(typeof self.pageYOffset!='undefined')
OffWindowHeight=self.pageYOffset;
else if(document.compatMode && document.compatMode != 'BackCompat')
OffWindowHeight=document.documentElement.scrollTop;
else if(document.body && typeof(document.body.scrollTop)!='undefined')
OffWindowHeight=document.body.scrollTop;
window.scrollTo(0,0);
return OffWindowHeight;
}
function WindowHeight()
{
var WindowHeight = 0;
if( typeof( window.innerWidth ) == 'number' )
WindowHeight = window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
WindowHeight = document.documentElement.clientHeight;
else if(document.body && document.body.clientHeight)
WindowHeight = document.body.clientHeight;
return WindowHeight;
}
function pHeight()
{
var pHeight = OffWindowHeight() + WindowHeight();
return pHeight;
}
function favBg()
{
var favHeight = document.getElementById('favBg');
favHeight.style.height = pHeight() + 'px';
}
var cdiv = "blank";
function favArea()
{
if (cdiv == "blank")
{ cdiv = window.setInterval("favArea()", 50); }
var msgBox = document.getElementById("favArea");
objh = parseFloat(msgBox.style.height)/2;
objw = parseFloat(msgBox.style.width)/2;
msgBox.style.top = Math.floor(Math.round((document.documentElement.offsetHeight/2)+document.documentElement.scrollTop)-objh)+'px';
msgBox.style.left = Math.floor(Math.round((document.documentElement.offsetWidth/2)+document.documentElement.scrollLeft)-objw)+'px';
}
function portfolio()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var portfolio = document.getElementById('portfolio');
portfolio.style.display = 'block';
}
function contact()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var contact = document.getElementById('contact');
contact.style.display = 'block';
}
function gallery()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var gallery = document.getElementById('gallery');
gallery.style.display = 'block';
}
function support()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var support = document.getElementById('support');
support.style.display = 'block';
}
function closeMsg()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'none';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'none';
var gallery = document.getElementById('gallery');
gallery.style.display = 'none';
var contact = document.getElementById('contact');
contact.style.display = 'none';
var portfolio = document.getElementById('portfolio');
portfolio.style.display = 'none';
var support = document.getElementById('support');
support.style.display = 'none';
}
</script>
<body onload="favBg(); favArea();">
<div id="favArea" class="favArea" style="width: 500px; height: 400px;">
<div id="gallery" class="gallery"><p class="infoMsg">gallery</p></div>
<div id="portfolio" class="portfolio"><p class="infoMsg">portfolio</p></div>
<div id="support" class="support"><p class="infoMsg">support</p></div>
<div id="contact" class="contact"><p class="infoMsg">contact</p></div>
<p class="closeMsg"><a onclick="closeMsg();">Close</a></p>
</div>
<div id="favBg" class="favBg"></div>
<div align="center">
<div style="width: 400px; height:200px; background-color: white;">
<form action="page.php" method="post">
<input onclick="closeMsg(); gallery();" class="buttons" style="color: blue;" type="button" value="gallery">
<input onclick="closeMsg(); contact();" class="buttons" style="color: yellow;" type="button" value="contact">
<input onclick="closeMsg(); support();" class="buttons" style="color: green;" type="button" value="support">
<input onclick="closeMsg(); portfolio();" class="buttons" style="color: red;" type="button" value="portfolio">
</form>
</div>
</div>
</body>
</html>
here all the order are changed, also the names of buttons(style+function+name+id etc.. related buttons).
but it still gives the same priority: green < red < blue < yellow.
in the following code i changed the colors of the divs, it gives priority to the exact same divs regardless of the properties defined to them.
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style>
p
{
margin: 0px;
padding: 0px;
}
body, html
{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
background-color: #e9e9e9;
}
form
{
margin: 0px;
padding: 0px;
}
.favBg
{
display: none;
border: 0px;
padding: 0px;
margin: 0px;
width: 100%;
position: absolute;
background-color: #000000;
opacity: 0.5;
filter: Alpha(opacity:50);
z-index: 999;
}
.favArea
{
display: none;
border-width: 1px;
border-style: solid;
border-color: #125717;
padding: 0px;
position: absolute;
background-color: white;
z-index: 1000;
}
.portfolio
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right:0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: green;
}
.contact
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: blue;
}
.gallery
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right:0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: yellow;
}
.support
{
display: none;
margin-top: 86px;
margin-bottom: 0px;
margin-left: 0px;
margin-right:0px;
padding: 0px;
width: 500px;
height: 295px;
position: relative;
background-color: red;
}
.infoMsg
{
padding-top: 10px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 10px;
margin-right: 10px;
font-family: Verdana, Arial, Tahoma;
font-weight: bolder;
font-size: 15px;
color: white;
letter-spacing: 0px;
position: relative;
}
.closeMsg
{
padding: 0px;
margin-top: 2px;
margin-bottom: 0px;
margin-left: 5px;
margin-right: 0px;
font-family: Verdana, Arial, Tahoma;
font-weight: none;
font-size: 12px;
color: black;
letter-spacing: 0px;
position: relative;
}
.buttons
{
border-width: 2px;
border-style: solid;
border-color: black;
padding: 0px;
margin-top: 80px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
</style>
<script>
function OffWindowHeight()
{
var OffWindowHeight=0;
window.scrollTo(0,10000000);
if(typeof self.pageYOffset!='undefined')
OffWindowHeight=self.pageYOffset;
else if(document.compatMode && document.compatMode != 'BackCompat')
OffWindowHeight=document.documentElement.scrollTop;
else if(document.body && typeof(document.body.scrollTop)!='undefined')
OffWindowHeight=document.body.scrollTop;
window.scrollTo(0,0);
return OffWindowHeight;
}
function WindowHeight()
{
var WindowHeight = 0;
if( typeof( window.innerWidth ) == 'number' )
WindowHeight = window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
WindowHeight = document.documentElement.clientHeight;
else if(document.body && document.body.clientHeight)
WindowHeight = document.body.clientHeight;
return WindowHeight;
}
function pHeight()
{
var pHeight = OffWindowHeight() + WindowHeight();
return pHeight;
}
function favBg()
{
var favHeight = document.getElementById('favBg');
favHeight.style.height = pHeight() + 'px';
}
var cdiv = "blank";
function favArea()
{
if (cdiv == "blank")
{ cdiv = window.setInterval("favArea()", 50); }
var msgBox = document.getElementById("favArea");
objh = parseFloat(msgBox.style.height)/2;
objw = parseFloat(msgBox.style.width)/2;
msgBox.style.top = Math.floor(Math.round((document.documentElement.offsetHeight/2)+document.documentElement.scrollTop)-objh)+'px';
msgBox.style.left = Math.floor(Math.round((document.documentElement.offsetWidth/2)+document.documentElement.scrollLeft)-objw)+'px';
}
function portfolio()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var portfolio = document.getElementById('portfolio');
portfolio.style.display = 'block';
}
function contact()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var contact = document.getElementById('contact');
contact.style.display = 'block';
}
function gallery()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var gallery = document.getElementById('gallery');
gallery.style.display = 'block';
}
function support()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'block';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'block';
var support = document.getElementById('support');
support.style.display = 'block';
}
function closeMsg()
{
var favBg = document.getElementById('favBg');
favBg.style.display = 'none';
var favAreaMsg = document.getElementById('favArea');
favAreaMsg.style.display = 'none';
var gallery = document.getElementById('gallery');
gallery.style.display = 'none';
var contact = document.getElementById('contact');
contact.style.display = 'none';
var portfolio = document.getElementById('portfolio');
portfolio.style.display = 'none';
var support = document.getElementById('support');
support.style.display = 'none';
}
</script>
<body onload="favBg(); favArea();">
<div id="favArea" class="favArea" style="width: 500px; height: 400px;">
<div id="gallery" class="gallery"><p class="infoMsg">gallery</p></div>
<div id="portfolio" class="portfolio"><p class="infoMsg">portfolio</p></div>
<div id="support" class="support"><p class="infoMsg">support</p></div>
<div id="contact" class="contact"><p class="infoMsg">contact</p></div>
<p class="closeMsg"><a onclick="closeMsg();">Close</a></p>
</div>
<div id="favBg" class="favBg"></div>
<div align="center">
<div style="width: 400px; height:200px; background-color: white;">
<form action="page.php" method="post">
<input onclick="closeMsg(); gallery();" class="buttons" style="color: yellow;" type="button" value="gallery">
<input onclick="closeMsg(); contact();" class="buttons" style="color: blue;" type="button" value="contact">
<input onclick="closeMsg(); support();" class="buttons" style="color: red;" type="button" value="support">
<input onclick="closeMsg(); portfolio();" class="buttons" style="color: green;" type="button" value="portfolio">
</form>
</div>
</div>
</body>
</html>
everything is completely in random order but still this happens...
Bookmarks