我希望將整個字符串'/image.htm?diskindex=0&diskcount=2&sortby=0&view=0&imagefilter=1&sizemore=1'
作爲參數actiondownloadsingle.htm
。如何使用javascript傳遞url地址字符串作爲url的參數?
而我嘗試使用encodeURI函數來編碼字符串,但我失敗了,我無法在服務器客戶端中獲取參數origurl的正確值,我該怎麼辦?謝謝!
$('.CssDownloadSingle').click(function() {
var fileName = GetHiddenFilename(this);
var origurl ='/image.htm?diskindex=0&diskcount=2&sortby=0&view=0&imagefilter=1&sizemore=1'
location.href = "actiondownloadsingle.htm?origurl=" +encodeURI(origurl);
});
你的問題回答[這裏](http://stackoverflow.com/questions/1737935/ JavaScript的是什麼 - 是最推薦的路到通網址-AS-URL參數)。 快捷方式:使用encodeURIComponent() –