Code:
function switchmenu(goto)
{
var current = document.GetElementById("placeholder");
current.style.visibility = "hidden";
document.goto.style.visibility = "visible";
current.value = goto;
}
A few other things, besides what Beetle pointed out:
- "goto" is a reserved word in javascript - you can't use it as a variable name
- you're attempting to use document.all to set the visibility, which won't work in many non-IE browsers
- You're actually selecting an element named "goto", which doesn't exist.
So:
Code:
function switchmenu(target)
{
var current = document.getElementById("placeholder");
current.style.visibility = "hidden";
document.getElementById(target).style.visibility = "visible";
current.value = target;
}
However, following on from Beetle's second question, I suspect that you're confused about how variables/variable names work, and what what you actually want is this:
Code:
function switchmenu(target)
{
var current = document.getElementById("placeholder");
document.getElementById(current.value).style.visibility = "hidden";
document.getElementById(target).style.visibility = "visible";
current.value = target;
}
[none of this has been tested, so no promises]
offtopic:
has anyone else found that code blocks do really funky things with indentation these days?
Bookmarks