A
Aaron Gray
Have not done any JavaScript for a year or so.
Cannot remember how to do this ?
Why is the following not working right ?
http://www.aarongray.org/comp.lang.javascript/test.html
~~~~~~~~~ test.html ~~~~~~~~~
<html>
<head>
<style>
#div_1 {
display: block;
}
#div_2 {
display: none;
}
#div_3 {
display: none;
}
#div_4 {
display: none;
}
</style>
<script>
old = "div_1";
function show(d) {
alert("test");
document.getElementById(old).style.display = "none";
document.getElementById(d).style.display = "block";
old = d;
}
</script>
</head>
<body>
<div>
<span onClick='show("div_1");'>1</a>
<span onClick='show("div_2");'>2</a>
<span onClick='show("div_3");'>3</a>
<span onClick='show("div_4");'>4</a>
</div>
<div>
<div id="div_1">
1
</div>
<div id="div_2">
2
</div>
<div id="div_3">
3
</div>
<div id="div_4">
4
</div>
</div>
</body>
</html>
~~~~~~~~~~~~~~~~~
Many thanks in advance,
Aaron
Cannot remember how to do this ?
Why is the following not working right ?
http://www.aarongray.org/comp.lang.javascript/test.html
~~~~~~~~~ test.html ~~~~~~~~~
<html>
<head>
<style>
#div_1 {
display: block;
}
#div_2 {
display: none;
}
#div_3 {
display: none;
}
#div_4 {
display: none;
}
</style>
<script>
old = "div_1";
function show(d) {
alert("test");
document.getElementById(old).style.display = "none";
document.getElementById(d).style.display = "block";
old = d;
}
</script>
</head>
<body>
<div>
<span onClick='show("div_1");'>1</a>
<span onClick='show("div_2");'>2</a>
<span onClick='show("div_3");'>3</a>
<span onClick='show("div_4");'>4</a>
</div>
<div>
<div id="div_1">
1
</div>
<div id="div_2">
2
</div>
<div id="div_3">
3
</div>
<div id="div_4">
4
</div>
</div>
</body>
</html>
~~~~~~~~~~~~~~~~~
Many thanks in advance,
Aaron