応用

JavaScriptのコードを実行

JavaScriptのコードを実行します。

						Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

								Dim script As String = ""

								script &= "function alertdisp(message) {" & vbCrLf
								script &= "	  alert(message);" & vbCrLf
								script &= "}" & vbCrLf
								script &= "alertdisp('test');" & vbCrLf
								_objIE.Navigate("javascript:" & Uri.EscapeDataString(script) & ";")

						End Sub
					

						Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

							Dim script As String = ""

							script &= "function alertdisp(message) {" & vbCrLf
							script &= "	  alert(message);" & vbCrLf
							script &= "}" & vbCrLf
							script &= "alertdisp('test');" & vbCrLf
							WebBrowser1.Url = New Uri("javascript:" & Uri.EscapeDataString(script) & ";")

						End Sub