scoutt
01-04-2002, 10:47 PM
does anybody know why this don't work? is it because the .style isn't supported?
<html>
<head>
<link type="text/css" rel="stylesheet" href="sislimenu.css">
<script type="text/javascript">
function slideSub(which) {
var which = Number(which);
var currSubMenu;
for (var i = 0; i < 2; i++) {
currSubMenu = document.getElementById("SubMenu" + i);
if (which == i) {
currSubMenu.style.left = 120;
}
else {
currSubMenu.style.left = 20;
}
}
}
</script>
</head>
<body>
<div class="SiSliMenu" style="top: 20; left: 20; width: 100; height: 420;">
<div class="MainEntry" style="top: 1; left: 1; width: 98; height: 20;" onClick="java script:slideSub(0);">
<span class="MainText">foo</span>
</div>
<div class="MainEntry" style="top: 22; left: 1; width: 98; height: 20;" onClick="java script:slideSub(1);">
<span class="MainText">bar</span>
</div>
</div>
<div class="SiSliSubMenu" id="SubMenu0" style="top: 20; left: 20; width: 100; height: 43; z-index: -1;">
<div class="SubEntry" style="top: 1; left: 1; width: 98; height: 20;"><span class="SubText">some foo</span></div>
<div class="SubEntry" style="top: 22; left: 1; width: 98; height: 20;"><span class="SubText">more foo</span></div>
</div>
<div class="SiSliSubMenu" id="SubMenu1" style="top: 42; left: 20; width: 100; height: 43; z-index: -1;">
<div class="SubEntry" style="top: 1; left: 1; width: 98; height: 20;"><span class="SubText">some bar</span></div>
<div class="SubEntry" style="top: 22; left: 1; width: 98; height: 20;"><span class="SubText">more bar</span></div>
</div>
</body>
</html>
sislimenu.css
div.SiSliMenu {
position: absolute;
z-index: 0;
border: 1px;
background-color: blue;
}
div.SiSliSubMenu {
position: absolute;
border: 1px;
background-color: gray;
}
div.MainEntry {
position: absolute;
border: 1px;
background-color: yellow;
text-align: center;
}
div.SubEntry {
position: absolute;
border: 1px;
background-color: green;
text-align: center;
}
span.MainText {
text-transform: capitalize;
}
span.SubText {
text-transform: capitalize;
}
<html>
<head>
<link type="text/css" rel="stylesheet" href="sislimenu.css">
<script type="text/javascript">
function slideSub(which) {
var which = Number(which);
var currSubMenu;
for (var i = 0; i < 2; i++) {
currSubMenu = document.getElementById("SubMenu" + i);
if (which == i) {
currSubMenu.style.left = 120;
}
else {
currSubMenu.style.left = 20;
}
}
}
</script>
</head>
<body>
<div class="SiSliMenu" style="top: 20; left: 20; width: 100; height: 420;">
<div class="MainEntry" style="top: 1; left: 1; width: 98; height: 20;" onClick="java script:slideSub(0);">
<span class="MainText">foo</span>
</div>
<div class="MainEntry" style="top: 22; left: 1; width: 98; height: 20;" onClick="java script:slideSub(1);">
<span class="MainText">bar</span>
</div>
</div>
<div class="SiSliSubMenu" id="SubMenu0" style="top: 20; left: 20; width: 100; height: 43; z-index: -1;">
<div class="SubEntry" style="top: 1; left: 1; width: 98; height: 20;"><span class="SubText">some foo</span></div>
<div class="SubEntry" style="top: 22; left: 1; width: 98; height: 20;"><span class="SubText">more foo</span></div>
</div>
<div class="SiSliSubMenu" id="SubMenu1" style="top: 42; left: 20; width: 100; height: 43; z-index: -1;">
<div class="SubEntry" style="top: 1; left: 1; width: 98; height: 20;"><span class="SubText">some bar</span></div>
<div class="SubEntry" style="top: 22; left: 1; width: 98; height: 20;"><span class="SubText">more bar</span></div>
</div>
</body>
</html>
sislimenu.css
div.SiSliMenu {
position: absolute;
z-index: 0;
border: 1px;
background-color: blue;
}
div.SiSliSubMenu {
position: absolute;
border: 1px;
background-color: gray;
}
div.MainEntry {
position: absolute;
border: 1px;
background-color: yellow;
text-align: center;
}
div.SubEntry {
position: absolute;
border: 1px;
background-color: green;
text-align: center;
}
span.MainText {
text-transform: capitalize;
}
span.SubText {
text-transform: capitalize;
}