....................
<input id="btn_ff8080811df94f0b011dfa8d07f700c7" stdCourseId="" style="color:;" type="button" name="button" class="inputbutton" value="选择" onclick="selectcourse('ff8080811df94f0b011dfa8d07f700c7','美国政治与外交')">
....................
我想请问如何根据别人输入的课程名称如'美国政治与外交',从网页源文件中找到对应的onclick的内容(selectcourse('ff8080811df94f0b011dfa8d07f700c7','美国政治与外交'))???或者找到对应的课程ID即"ff8080811df94f0b011dfa8d07f700c7“
请大家帮帮我啊~~~thanks~~~
6 个解决方案
#1
没研究过WebBrowser!!
帮你顶!!
帮你顶!!
#2
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim strHtml As String = Me.WebBrowser1.Document.Body.InnerHtml
Dim r As New System.Text.RegularExpressions.Regex("(?<=onclick=").*美国政治与外交[^"]*(?=")")
Dim m As System.Text.RegularExpressions.Match = r.Match(strHtml)
If m.Success Then
MsgBox(m.Value)
End If
End Sub
#3
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim strHtml As String = Me.WebBrowser1.Document.Body.InnerHtml
Dim r As New System.Text.RegularExpressions.Regex("(?<=onclick="").*美国政治与外交[^""]*(?="")")
Dim m As System.Text.RegularExpressions.Match = r.Match(strHtml)
If m.Success Then
MsgBox(m.Value)
End If
End Sub
#4
谢谢lizhengnan~但是那个正则表达式("(?<=onclick="").*美国政治与外交[^""]*(?="")")
好像不正确...我不会...能帮我改一下吗???~~thanks
好像不正确...我不会...能帮我改一下吗???~~thanks
#5
出的结果不对吗?
#6
对了,我自己搞错了~thanks
#1
没研究过WebBrowser!!
帮你顶!!
帮你顶!!
#2
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim strHtml As String = Me.WebBrowser1.Document.Body.InnerHtml
Dim r As New System.Text.RegularExpressions.Regex("(?<=onclick=").*美国政治与外交[^"]*(?=")")
Dim m As System.Text.RegularExpressions.Match = r.Match(strHtml)
If m.Success Then
MsgBox(m.Value)
End If
End Sub
#3
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim strHtml As String = Me.WebBrowser1.Document.Body.InnerHtml
Dim r As New System.Text.RegularExpressions.Regex("(?<=onclick="").*美国政治与外交[^""]*(?="")")
Dim m As System.Text.RegularExpressions.Match = r.Match(strHtml)
If m.Success Then
MsgBox(m.Value)
End If
End Sub
#4
谢谢lizhengnan~但是那个正则表达式("(?<=onclick="").*美国政治与外交[^""]*(?="")")
好像不正确...我不会...能帮我改一下吗???~~thanks
好像不正确...我不会...能帮我改一下吗???~~thanks
#5
出的结果不对吗?
#6
对了,我自己搞错了~thanks