Example of using JavaScript to invoke ASP implementation process
Source: Internet
Author: User
Javascript| process You may have seen this way of calling:
<script language= "javascript" src= "Xxx.js" ></script>
You may also have seen:
<!--#include file= "xxx.asp"-->
But you may not have seen the following calls:
<script language= "javascript" src= "Xxx.asp?borid=5&page_no=3" ></script>
Yes, please believe that your eyes, is a script to call the ASP file, in fact, this method has been used online quite ordinary, if you play the network, you must know that it provides the function of the post call, think, the code is similar to this?
<script language= "javascript" src= "Xxx.asp?borid=5&page_no=3" ></script> will xxx.asp?borid=5& Page_no=3 results are displayed on the page, which is better than the <!--#include file= "xxx.asp"--> where you may have seen it, it is possible to pass parameters and display the results, below a simple example:
Index.htm:
<body>
<script language= "javascript" src= "Dy.asp?num=1" ></script>
</body>
Dy.asp:
<%
Dim Temp
temp=request.querystring ("num")
If Temp=1 Then
Response.Write "document.write (' www.baidu.com ');"
Elseif temp=2 Then
Response.Write "document.write (' www.163.com ');"
Else
Response.Write "document.write (' www.sohu.com ');"
End If
%>
Note that the output of the ASP file must be written according to the JavaScript specification, such as:
Response.Write "document.write (' www.baidu.com ');"
The content of your ASP file output will be:
document.write (' www.baidu.com ');
This conforms to the JavaScript specification, otherwise the result prompts a script error or a blank!!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service