在claissic asp中显示页面 [英] display a page in claissic asp

查看:97
本文介绍了在claissic asp中显示页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的经典asp,它使用Web服务返回一个我需要显示的URL.我在显示返回的字符串时遇到问题.我无法找出正确的语法来做到这一点.这是代码:

I have a simple classic asp that uses a web service which returns a url that I need to display. I''m having problems displaying the returned string. I can not figure out the correct syntax to do this. Here is the code:

<html>
<head>
<title>Calling a webservice from classic ASP</title>
</head>
<body>
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Dim xmlhttp
Dim chartUrl
Dim DataToSend
DataToSend="acctNum="&Request.Form("txtacctNum")&"&MRN="&Request.Form("txtMRN")
Dim postUrl
postUrl = " http://localhost/edChartLink2/edChartLink2/edChartLink.asmx/GetToken"
Set xmlhttp = server.Createobject("MSXML2.XMLHTTP")
xmlhttp.Open "POST",postUrl,false
xmlhttp.setRequestHeader "Content-Type:", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend & "
"
Response.Write(xmlhttp.responseText)
//chartUrl = xmlhttp.responseText

document.write=xmlhttp.responseText

End If
%>
<FORM method=POST name="form1">
Enter the two Values to be Added

<INPUT type="text" name="txtacctNum">
<INPUT type="text" name="txtMRN">



<INPUT type="submit" >
</form>
</body>



我可以通过xmlhttp.reponsetext返回URL,没有问题,但是我尝试使用各种格式的document.write windows.write仍然出现错误.



I get the url back in xmlhttp.reponsetext with no problem but I have tried using document.write windows.write in various formats and I still get an error.

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''''
/edChartlink2/edChartlink2/Allscript2.asp, line 21



任何人都可以阐明这一点,然后告诉我正确的语法是什么.

注意:我是这个新手,谢谢
Jose''



Can anybody shed some light on this and tell me what is the correct syntax.

Note: I''m new at this, thanks
Jose''

推荐答案

文档对象在VB中不存在.它是一个JavaScript的东西,甚至在Javascript中,document.write都是方法而不是属性.应该像
这样使用
document object does not exist in VB. It''s a javascript thingie and even in Javascript, document.write is a method and not a property. Should be used like

document.write("whatever...")


另一响应者已经解释了问题的原因.
只需替换以下行:
The other responder has already explained the cause of the issue.

Just replace the line:
document.write=xmlhttp.responseText




with

document.write(xmlhttp.responseText)



并且应该可以正常工作.


正如Yusuf指出的那样,document是DOM对象,无法在服务器端进行处理.

您已经将xmlhttp.responseText的值写入Response,下一行是做什么的?
注释该行应该可以正常工作.



and it should work fine.


As Yusuf pointed out that document is a DOM object and couldn''t be processed at server side.

You are already writing the value of xmlhttp.responseText to the Response, what the next line is for?
Commenting that line should work fine.


这篇关于在claissic asp中显示页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆