对话框的部分代码如下:<SCRIPT type=text/javascript></SCRIPT><TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=tab_bar noWrap width="10%">员工编辑</TD>
<TD id=staffEditTable.modifyPassword style="DISPLAY: block" align=right><INPUT class=button id=staffEditTable.activePartyRoleBtn onclick=activePartyRole(); type=button value=激活员工号> <INPUT class=button_key onclick=modifyPass(); type=button value=重置口令> </TD></TR></TBODY></TABLE></TD>
<TD width=5 height=22><IMG height=22 src="../images/table/tab_blue_bar_right.gif" width=5></TD></TR><INPUT type=hidden value=830108983 name=staffEditTable.partyRoleId> 
<TR class=tab_blue_color vAlign=top>
<TD align=middle colSpan=3>
<TABLE cellSpacing=1 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD class=td_txt width="13%">员工号 </TD>
<TD width="20%"><INPUT onkeypress=onKeypressForLetterAndNumber() id=staffEditTable.staffCode onblur=checkLetterAndNumber(); title=员工号 value=734010315 prompt="员工号"><SPAN class=red_point>*</SPAN> </TD>
<TD class=td_txt width="13%">员工描述 </TD>
<TD colSpan=3><INPUT id=staffEditTable.staffDesc title=员工描述 style="WIDTH: 97%" value=张为平><SPAN class=red_point>*</SPAN> </TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD width=5 height=5><IMG height=5 src="../images/table/tab_blue_bottom_left.gif" width=5></TD>
<TD class=tab_blue_color width="100%"><IMG height=5 src="../images/shim.gif" width=5></TD>
<TD width=5 height=5><IMG height=5 src="../images/table/tab_blue_bottom_right.gif" width=5></TD></TR></TBODY></TABLE>
<TABLE id=partyRoleSaveTable cellSpacing=2 cellPadding=5 width="100%" border=0>
<TBODY>
<TR align=middle>
<TD><INPUT class=button id=partyRoleSaveTable.saveButton onclick=savePartyRole(); type=button value="确 定"> <INPUT class=button id=partyRoleSaveTable.clearButton onclick=clearPartyRole(); type=button value="重 置"> <INPUT class=button id=closeButton onclick=closePartyRole(); type=button value="关 闭"> </TD></TR></TBODY></TABLE>
<SCRIPT type=text/javascript>
window.setTimeout("initPage()",2);
</SCRIPT>
如何点击到上面 激活员工号、重置口令、确 定、重 置、关 闭按钮并执行相应代码

解决方案 »

  1.   

    document.getElementById("staffEditTable.staffCode").focus();
    其他的都一样,获取焦点
      

  2.   

    在WINFORM中是个弹出的对话框,怎么能获取DOCUMENT,最多只能获取ITHMLDOCUMENE2,代码是从ITHMLDOCUME2获取的
      

  3.   

    是WINFORM的WEBBROWSE的一个对话弹出框,代码是获取窗口句柄转化为ITHMLDOCUMENT2得到的,程序的部分代码如下:
      WEBBROWSE点击上页按钮弹出窗口代码:
      private void button3_Click(object sender, EventArgs e)
      {  HtmlDocument objDoc = webBrowser1.Document.Window.Frames["ModelFrame"].Document;
      objDoc.GetElementById("partyRoleTree").Parent.Document.InvokeScript("editPartyRoleFun");
      }
      //获取弹出窗口代码
      private void button5_Click(object sender, EventArgs e)
      {
      IntPtr hd = FindWindow("Internet Explorer_TridentDlgFrame", "参与人角色 -- 网页对话框");
      while (hd != IntPtr.Zero) //工号存在
      {  int lngMsg = 0;
      int lRes;
      IntPtr hchild = FindWindowEx(hd, IntPtr.Zero, "Internet Explorer_Server", String.Empty);
      if (!hchild.Equals(IntPtr.Zero))
      {
      lngMsg = RegisterWindowMessage("WM_HTML_GETOBJECT");
      if (lngMsg != 0)
      {
      SendMessageTimeout(hchild, lngMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, out lRes);
      if (!(bool)(lRes == 0))
      {
      int hr = ObjectFromLresult(lRes, ref IID_IHTMLDocument, 0, ref document);
      if ((bool)(document == null))
      {
      MessageBox.Show("No IHTMLDocument Found!", "Warning");
      }
      else
      {
      richTextBox1.Text = document.parentWindow.document.body.innerHTML;
      richTextBox1.Text += document.location.ToString();
      richTextBox1.SaveFile("temp.html", RichTextBoxStreamType.PlainText);
      }
      }  }
      }
      }  
      }  }