Results 1 to 2 of 2

Thread: setfocus

  1. #1
    chixdiggit Guest

    Default setfocus

    I have a text box within a table. I have created the sub below to generate a new row automatically (text box) in that table directly below the text box. It autoexpands, meaning that it will continue to generate a new row ech time a user types info into the text box. Here lies the problem. I have another table to the right of the table I am working on. I am trying to set focus (tab index, whatever!) to the new text box that is created. Right now, the focus shifts from right to left, so the focus does not go to the newly created text box. How do I get the focus to go to the newly created text box located below the original text box instead of the focus going to the right of the original text box. Did I make myself clear?<BR><BR>sub doInsertResource()<BR> dim curRow,i<BR> curRow = tblResource.rows.length<BR> if document.all.item("dispresource",curRow - 1).value &#060;&#062; "" then<BR> tblResource.insertRow()<BR> tblResource.rows(curRow).insertCell()<BR> tblResource.rows(curRow).cells(0).innerHTML = "&#060;input type=text size=36 id=dispresource name=dispresource onchange=doAddRowResource()&#062;"<BR> &#039;document.all.item("dispresource").setfocus<B R> end if<BR> &#039;tblResource.scrollIntoView(true)<BR>end sub

  2. #2
    chixdiggit Guest

    Default RE: setfocus

    Someone HELP me, please. Here is the code I am working on. <BR><BR>&#060;input type="text" size="28" id=dispname name=dispname onchange="doAddRow()"&#062; <BR><BR>sub doAddRow() <BR> dim curRow <BR> if window.event.srcElement.value &#060;&#062; "" then <BR> curRow = tblNamelist.rows.length <BR>if document.all.item("dispname",curRow - 1).value = "" then exit sub <BR>doInsert() <BR>else <BR>&#039;tblNamelist.deleteRow(window.event.srcEl ement.parentElement.parentElement.rowIndex) <BR>end if <BR>end sub <BR><BR>&#039;sub is called on an onchange event for a text box in my page <BR>sub doInsertResource() <BR>dim curRow,i <BR>curRow = tblResource.rows.length <BR>if document.all.item("dispresource",curRow - 1).value &#060;&#062; "" then <BR>tblResource.insertRow() <BR>tblResource.rows(curRow).insertCell() <BR>tblResource.rows(curRow).cells(0).innerHTML = "&#060;input type=text size=36 id=dispresource name=dispresource onchange=doAddRowResource()&#062;" <BR>end if <BR>&#039;tblResource.scrollIntoView(true) <BR>end sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts