G
GarryJones
The following works in MSIE but not firefox.
I suspect it has something to do with the fact that the element I am
trying to access is not the "tid" which is the name of the DIV that is
passed to this javascript. The function is a "show/hide" for a form. I
want to ensure that any possible previously entered value is cleared
so the user starts with an empty field with focus.
I have tried to ways, with naming and getElementById but in both
cases any entry is left standing and the focus is not passed in
firefox, whilst both work fine in MSIE.
First attempt (with getElementById)
function InsertContentshowgruppanm(tid) {
if( document.getElementById(tid).style.display == "none") {
document.getElementById(tid).style.display = "block";
document.getElementById("grant_ask").selectedIndex=0;
document.getElementById("tavfnmkas").value="";
document.getElementById("tavfnmkas").focus()
}
else {
document.getElementById(tid).style.display = "none";
}
}
Second attempt (with name of form inserted)
function InsertContentshowgruppanm(tid) {
if( document.getElementById(tid).style.display == "none") {
document.getElementById(tid).style.display = "block";
document.getElementById("grant_ask").selectedIndex=0;
document.prel_svlmst_grpcol.tavfnmkas.focus()
}
else {
document.getElementById(tid).style.display = "none";
}
}
So obvious question. Whats the syntax for firefox?
I suspect it has something to do with the fact that the element I am
trying to access is not the "tid" which is the name of the DIV that is
passed to this javascript. The function is a "show/hide" for a form. I
want to ensure that any possible previously entered value is cleared
so the user starts with an empty field with focus.
I have tried to ways, with naming and getElementById but in both
cases any entry is left standing and the focus is not passed in
firefox, whilst both work fine in MSIE.
First attempt (with getElementById)
function InsertContentshowgruppanm(tid) {
if( document.getElementById(tid).style.display == "none") {
document.getElementById(tid).style.display = "block";
document.getElementById("grant_ask").selectedIndex=0;
document.getElementById("tavfnmkas").value="";
document.getElementById("tavfnmkas").focus()
}
else {
document.getElementById(tid).style.display = "none";
}
}
Second attempt (with name of form inserted)
function InsertContentshowgruppanm(tid) {
if( document.getElementById(tid).style.display == "none") {
document.getElementById(tid).style.display = "block";
document.getElementById("grant_ask").selectedIndex=0;
document.prel_svlmst_grpcol.tavfnmkas.focus()
}
else {
document.getElementById(tid).style.display = "none";
}
}
So obvious question. Whats the syntax for firefox?