G
gerg
I've got the following script that toggles the visibility of a <form>
from Display: none, to Display: Block. Works great. But when I try to
first run a check like:
function show(id){
var el = document.getElementById(id);
if(el.style.display == 'none'){
el.style.display = 'visible';
}
else
{
el.style.display = 'none';
}
}
it doesn't work. The CSS and HTML is below:
The CSS looks like this:
#myform {
display: none;
}
The html looks like this:
<div id="login">
<h1><a href="#" onclick="show('myform')">Login</a></h1>
</div>
<div id="loginform">
<form id="myform" name="login">
UserName: <input name="username" type="text" size="15" /><br />
PassWord: <input name="" type="password" />
</form>
</div>
I admit to total newbieness so I'm still in the learning curve. I've
googled various things but haven't been able to figure this out. Thanks
again in advance.
greg g.
from Display: none, to Display: Block. Works great. But when I try to
first run a check like:
function show(id){
var el = document.getElementById(id);
if(el.style.display == 'none'){
el.style.display = 'visible';
}
else
{
el.style.display = 'none';
}
}
it doesn't work. The CSS and HTML is below:
The CSS looks like this:
#myform {
display: none;
}
The html looks like this:
<div id="login">
<h1><a href="#" onclick="show('myform')">Login</a></h1>
</div>
<div id="loginform">
<form id="myform" name="login">
UserName: <input name="username" type="text" size="15" /><br />
PassWord: <input name="" type="password" />
</form>
</div>
I admit to total newbieness so I'm still in the learning curve. I've
googled various things but haven't been able to figure this out. Thanks
again in advance.
greg g.