WebBrowser1 INPUT Action
Hvordan for jeg den fulde url fra "INPUT Action" ligsom det man får når man click på et "A" link.Problemet ligger nede i MsHtml_Doc_onclick()
'------------------- Form1 -------------------
Option Explicit
'References "Micfosoft HTML Object Library"
Private WithEvents MsHtml_Doc As HTMLDocument 'MSHTML.HTMLDocument
Private MsHtml_Window As HTMLWindow2 'MSHTML.HTMLWindow2
Private MsHtml_Form As HTMLFormElement 'MSHTML.HTMLFormElement
Private Sub Command1_Click()
WebBrowser1.Navigate "http://hjem.get2net.dk/sjh/eksperten/browsertest/"
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "about:blank"
End Sub
Private Function MsHtml_Doc_onclick() As Boolean
Dim strTag As String
Dim objSrc As HTMLInputButtonElement
Set objSrc = MsHtml_Window.event.srcElement
strTag = objSrc.tagName
'MsgBox "Tag: " & strTag
'Click for INPUT
If UCase(strTag) = ("INPUT") Then
'MsgBox "Type: " & objSrc.Type
If LCase(objSrc.Type) = "submit" Or LCase(objSrc.Type) = "image" Then
Set MsHtml_Form = objSrc.Form
BuildForm MsHtml_Form.method
'WebBrowser1.Navigate "C:\Inetpub\wwwroot\" & objSrc.Form.Action
'************ Problem Problem Problem ************
MsgBox "Action: " & objSrc.Form.Action
'************ Problem Problem Problem ************
End If
End If
'Click for A link
If UCase(strTag) = ("A") Then
'BuildLink MsHtml_Window.event.srcElement
MsgBox MsHtml_Window.event.srcElement
End If
End Function
Private Sub MsHtml_Doc_onkeyup()
Dim objSrc As HTMLInputButtonElement
Set objSrc = MsHtml_Window.event.srcElement
End Sub
Private Sub BuildForm(ByVal how As String)
Dim e As HTMLInputElement
Dim strVal As String
Dim strName As String
For Each e In MsHtml_Form.children
strVal = "": strName = ""
If Not IsNull(e.getAttribute("Name")) Then
If e.getAttribute("Name") <> "" Then
strName = e.getAttribute("Name")
End If
End If
If Not IsNull(e.getAttribute("value")) Then
If e.getAttribute("value") <> "" Then
strVal = e.getAttribute("value")
End If
End If
If strName <> "" Then
'Add INPUT info
List1.AddItem strName & "=" & strVal
End If
Next
End Sub
Private Sub BuildLink(ByVal how As String)
'
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Set MsHtml_Doc = WebBrowser1.Document
Set MsHtml_Window = MsHtml_Doc.parentWindow
End Sub
'------------------- Form1 -------------------
