[javascript]用get方式傳遞網頁參數時,請善用encodeURIComponent,以免亂碼

  • 1355
  • 0

摘要:[javascript]用get方式傳遞網頁參數時,請善用encodeURIComponent,以免亂碼

下面是傳送端

var sURL = '/my.aspx?cname=' + encodeURIComponent(txtMyName.value) ;

下面是接收端

txtMyName.Text = Server.UrlDecode(Request("mycname"))