我已經嘗試了一些關於URL編碼的提示,但到目前爲止我還沒有成功。首先,我得到這種格式,這個JavaScript編碼是否正確寫入?
var url = "http://www.polyvore.com/cgi/add?title="
+ encodeURIComponent(%%GLOBAL_ProductName%%)
+ "&url=" + encodeURIComponent("http://lilaboutique.co.uk/products/"
+ encodeURIComponent(%%GLOBAL_ProductName%%)
+ "&imgurl=" + encodeURIComponent(%%GLOBAL_ThumbImageURL%%)
+ "&desc=" + encodeURIComponent(%%GLOBAL_ProductDesc%%)
+ "&price=" + encodeURIComponent(%%GLOBAL_ProductPrice%%));
永遠不會被傳遞給href dunno是什麼原因。然後我打了它多一些,
var url = "http://www.polyvore.com/cgi/add?title=encodeURIComponent(%%GLOBAL_ProductName%%)&url=http://lilaboutique.co.uk/products/encodeURIComponent(%%GLOBAL_ProductName%%)&imgurl=encodeURIComponent(%%GLOBAL_ThumbImageURL%%)&desc=encodeURIComponent(%%GLOBAL_ProductDesc%%)&price=encodeURIComponent(%%GLOBAL_ProductPrice%%)";
此時網址獲得通過,但顯示編碼功能本身的適當和其他領域之間進行混合的值。
任何幫助澄清我的錯誤是非常感謝。我想編碼只是價格和描述,似乎是給出問題的領域。
常規鏈接並呈現沒有問題
var url = "www.google.com";
var myAnchor = document.getElementById('myAnchor');
myAnchor.href = url;
感謝所有幫助
其實,那個右括號就在最後。這是我錯誤的錯誤格式化他的代碼,最後4行應進一步縮進澄清。 – 2010-08-13 17:19:37
這段代碼是藝術品哈哈,但不得不說,我仍然從一開始就遇到問題。我不知道價格和描述沒有通過什麼原因。我希望我能訪問php腳本文件,這將是一件輕而易舉的事情,但bigcommerce不提供這一點。如果您有其他提示可深入瞭解這些全局變量的返回情況,請告訴我。謝謝您的幫助。 – elramirez 2010-08-13 18:03:20
只是做一些調試'(我在toEncode)警報(我+'='+ toEncode [i]);'看看每個返回 – 2010-08-13 19:14:30