<INPUT  name="user" onkeypress=db(0); style="DISPLAY: block" >
网页中的代码这样.

解决方案 »

  1.   

    function simulateClick() {
      var evt = document.createEvent("MouseEvents");
      evt.initMouseEvent("click", true, true, window,
        0, 0, 0, 0, 0, false, false, false, false, 0, null);
      var cb = document.getElementById("checkbox"); 
      var canceled = !cb.dispatchEvent(evt);
      if(canceled) {
        // A handler called preventDefault
        alert("canceled");
      } else {
        // None of the handlers called preventDefault
        alert("not canceled");
      }
      

  2.   

        Dim oDoc As HTMLDocument
        Set oDoc = pDisp.Document
            
        Dim oInput As HTMLInputElement
        Set oInput = oDoc.getElementsByName("user")(0)
        oInput.FireEvent "onkeypress"
        
      

  3.   

    引用Microsoft HTML Object Libary
      

  4.   

    早上自己解决了``谢谢楼上的``
    Dim vDoc, vTag
    Dim I As Integer
    Set vDoc = WB1.Document
    For I = 0 To vDoc.All.length - 1
        If UCase(vDoc.All(I).tagName) = "INPUT" Then
        Set vTag = vDoc.All(I)
            If vTag.Type = "text" Then
            Select Case vTag.Name
            Case "username" '如果是用户名的那个框
             vTag.Value = "用户名" '这个是用户名
             vTag.onkeypress
            End Select
            
            End If
        End If
    Next I