The reason for this has do to with the nature of WebTV and will be
directed to WebTV users with a conditional so that it will have no
effect on PC users.
I'm trying to create a function that will put focus to a form element
(with a short delay) when the division that it is in is changed from
hidden to visible.
For a one time use, this works:
function showDiv()
{
if (navigator.appN ame.indexOf("We bTV") != -1)
{
setTimeout("doc ument.getElemen tById('theinput ').focus();", 50);
}
document.getEle mentById("hidde ndiv").style.vi sibility = "visible";
document.getEle mentById("visib lediv").style.v isibility = "hidden";
}
Both divisions have these embedded CSS rules:
#visiblediv, #hiddendiv {
width: 100%;
height: 100%;
text-align: center;
position: absolute;
left: auto;
top: 65px;
}
#visiblediv {
visibility: visible;
}
#hiddendiv {
visibility: hidden;
}
And in the body:
<a href="javascrip t:void();" onclick="openDi v(); return false;">Display
The Form</a>
<div id="visiblediv" >
division content
</div>
<div id="hiddendiv" >
division content including a text link with a function to hide this
division again and a form containing the text input with the id of
"theinput"
</div>
However, I want to use this function more than once. When I try this it
doesn't work:
function showDiv(in_foc)
{
if (navigator.appN ame.indexOf("We bTV") != -1)
{
setTimeout("doc ument.getElemen tById(in_foc).f ocus();", 50);
}
document.getEle mentById("hidde ndiv").style.vi sibility = "visible";
document.getEle mentById("visib lediv").style.v isibility = "hidden";
}
Then in the body:
<a href="javascrip t:void();" onclick="openDi v('theinput'); return
false;">Display The Form</a>
hiddendiv becomes visible but the focus() does not work. I realize it
has to do with how I'm addressing the variable, I just can't figure out
what I'm doing wrong.
Later, Art.
directed to WebTV users with a conditional so that it will have no
effect on PC users.
I'm trying to create a function that will put focus to a form element
(with a short delay) when the division that it is in is changed from
hidden to visible.
For a one time use, this works:
function showDiv()
{
if (navigator.appN ame.indexOf("We bTV") != -1)
{
setTimeout("doc ument.getElemen tById('theinput ').focus();", 50);
}
document.getEle mentById("hidde ndiv").style.vi sibility = "visible";
document.getEle mentById("visib lediv").style.v isibility = "hidden";
}
Both divisions have these embedded CSS rules:
#visiblediv, #hiddendiv {
width: 100%;
height: 100%;
text-align: center;
position: absolute;
left: auto;
top: 65px;
}
#visiblediv {
visibility: visible;
}
#hiddendiv {
visibility: hidden;
}
And in the body:
<a href="javascrip t:void();" onclick="openDi v(); return false;">Display
The Form</a>
<div id="visiblediv" >
division content
</div>
<div id="hiddendiv" >
division content including a text link with a function to hide this
division again and a form containing the text input with the id of
"theinput"
</div>
However, I want to use this function more than once. When I try this it
doesn't work:
function showDiv(in_foc)
{
if (navigator.appN ame.indexOf("We bTV") != -1)
{
setTimeout("doc ument.getElemen tById(in_foc).f ocus();", 50);
}
document.getEle mentById("hidde ndiv").style.vi sibility = "visible";
document.getEle mentById("visib lediv").style.v isibility = "hidden";
}
Then in the body:
<a href="javascrip t:void();" onclick="openDi v('theinput'); return
false;">Display The Form</a>
hiddendiv becomes visible but the focus() does not work. I realize it
has to do with how I'm addressing the variable, I just can't figure out
what I'm doing wrong.
Later, Art.
Comment