当前位置: 代码迷 >> ASP >> Server.UrlEncode 编码传值?请帮忙解决,多谢
  详细解决方案

Server.UrlEncode 编码传值?请帮忙解决,多谢

热度:551   发布时间:2012-02-21 16:26:23.0
Server.UrlEncode 编码传值?请帮忙解决,谢谢
<%
if   Request( "action ")= "sss "   then
text=Request.querystring( "text ")
Response.Write   text
Response.End
end   if
%>
<form   id= "form1 "   name= "form1 "   method= "post ">
    <input   type= "text "   name= "text "   />
<input   name= "button "   type= "button "   value= "提交 "  
onClick= "location.href= '122222.asp?action=sss&text= <%=Server.UrlEncode   ()%> '+document.form1.text.value+ ' ' ">   </form>


------解决方案--------------------
<form id= "form1 " name= "form1 " method= "post " action= " ">
改:
<input name= "button " type= "button " value= "提交 "
onClick= "location.href= '122222.asp?action=sss&text= <%=Server.UrlEncode ()%> '+document.form1.text.value+ ' ' ">  为:
<input name= "button " type= "button " value= "提交 "
onClick= "document.form1.action= '122222.asp?action=sss&text= '+escape(document.form1.text.value)+ ' ' ">  

你要直接改就用escape()
  相关解决方案