You could pass the identifier for the text box as a third parameter to the expandcontent function:
Code:
<table onClick="expandcontent(this, 'sc1', document.myForm.myTextBox);">
Then in the function add code to focus it only on expand (additions in red):
Code:
function expandcontent(curobj, cid, formIdent){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (document.getElementById(cid).style.display=="block"&&formIdent!==undefined)
formIdent.focus();
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}
Bookmarks