可以用,用比如
msgbox(e.PlainText)
以下是完整代码
Dim e As RequestEventArgs = args(0)
Dim sb As New StringBuilder
Select Case e.path
Case "login"
sb.AppendLine(" <!DOCTYPE html> ")
sb.AppendLine(" <html> ")
sb.AppendLine(" <head> ")
sb.AppendLine(" <title></title> ")
sb.AppendLine(" <script type='text/javascript'> ")
sb.AppendLine(" function loadXMLDoc() { ")
sb.AppendLine(" var xmlhttp; ")
sb.AppendLine(" if (window.XMLHttpRequest) { ")
sb.AppendLine(" xmlhttp = new XMLHttpRequest(); ")
sb.AppendLine(" } ")
sb.AppendLine(" else { ")
sb.AppendLine(" xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); ")
sb.AppendLine(" } ")
sb.AppendLine(" xmlhttp.onreadystatechange = function () { ")
sb.AppendLine(" if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { ")
sb.AppendLine(" document.getElementById('myDiv').innerHTML = xmlhttp.responseText; ")
sb.AppendLine(" } ")
sb.AppendLine(" } ")
sb.AppendLine(" xmlhttp.open('POST', 'login.htm', true); ")
sb.AppendLine(" xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); ")
sb.AppendLine(" xmlhttp.send('a=123'); ")
sb.AppendLine(" } ")
sb.AppendLine(" </script> ")
sb.AppendLine(" </head> ")
sb.AppendLine(" <body> ")
sb.AppendLine(" <h2></h2> ")
sb.AppendLine(" <button type='button' >获取数据</button> ")
sb.AppendLine(" <br /> ")
sb.AppendLine(" <br /> ")
sb.AppendLine(" <br /> ")
sb.AppendLine(" <div id='myDiv' style='color:red'></div> ")
sb.AppendLine(" </body> ")
sb.AppendLine(" </html> ")
e.WriteString(sb.ToString)
Case "login.htm"
msgbox(e.PlainText) '这里获取的e.PlainText都是空的
sb.AppendLine(" <!DOCTYPE html> ")
sb.AppendLine(" <html> ")
sb.AppendLine(" <head> ")
sb.AppendLine(" <title>123</title> ")
sb.AppendLine(" </head> ")
sb.AppendLine(" <body> ")
sb.AppendLine(" 4567890 ")
sb.AppendLine(" </body> ")
sb.AppendLine(" </html> ")
e.WriteString(sb.ToString())
End Select
我按上面代码,获取e.PlainText都是空的,请问我的代码错在哪里?
[此贴子已经被作者于2019/6/6 17:15:04编辑过]