欢迎光临
我们一直在努力

嘿,大家瞧瞧这老外在页面之间传递元素的办法

建站超值云服务器,限时71元/月

在第三方页面传递参数这个思路倒是的确可以省下一些代码,至少我以前是从没这样子传过。
<%
    pass form objects submitted by a form g
         et
    if request.querystring.count>0 then
    qstr="?"
    for each x in request.querystring
    qstr = qstr & x & "="    write name of parameter
    qstr = qstr & server.urlencode(request.querystring(x)) & "&" write value of parameter
    next
    qstrsz = len(qstr)-1
    qstr = left(qstr,qstrsz)
    else
    qstr=""
    end if
    response.redirect("yoururl.asp" & qstr)
    %>
    the next example shows how to build the submitted parameters from a form post. the procedure reads all posted objects and builds a querystring parameter.
    <%
    pass form objects submitted by a form g
         et
    if request.form.count>0 then
    qstr="?"
    for each x in request.form
    qstr = qstr & x & "="    write name of parameter
    qstr = qstr & server.urlencode(request.form(x)) & "&" write value of parameter
    next
    qstrsz = len(qstr)-1
    qstr = left(qstr,qstrsz)
    else
    qstr=""
    end if
    response.redirect("yoururl.asp" & qstr)
    %>
    the next code example may be used as a test asp page to redirect to. it reads the querystring and builds a table to display the parameter name and value passed.
    <%@ language=vbscript %>
    <html>
    <body>
    <%
    response.write "<table border=1><tr><th>parameter</th><th>value</th></tr>"
    for each x in request.querystring
    response.write "<tr><td>" & x & "</td><td>" write name of parameter
    response.write request.querystring(x) & "</td></tr>" write value of parameter
    next
    response.write "</table>"
    %>
    </body>
    </html>
当然,上面这个东西的改进版本就简洁多了,再看这个
<%
if
request.querystring.count > 0 then
  
response.redirect("yoururl.asp?" &
request.querystring
else
  if
request.form.count > 0 then
    
response.redirect("yoururl.asp?" &
request.form)
  else
    
response.write("no data sent")
  end
if
end if
%>
原来可以整个抓取的,我也是刚刚知道,不敢独吞,拿出来共享

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 嘿,大家瞧瞧这老外在页面之间传递元素的办法
分享到: 更多 (0)