我試圖生成應該看起來像這樣的亞馬遜廣告。Javascript重定向到源代碼,而不是加載
<script type="text/javascript"><!--
amazon_ad_tag = "xxxxxxx"; amazon_ad_width = "160"; amazon_ad_height = "600";//--></script>
<script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script>
下面是我的腳本應該實現的部分。腳本BTW是用於旋轉更多類型的聯盟廣告。
首先是與所有的亞馬遜廣告選項的全局變量...
ad_code = 'amazon_ad_tag = "xxxxxxx"; amazon_ad_width = "160"; amazon_ad_height = "600";';
接下來,我裝在一個「ad_slot」分區的ad_code
。 ad_code
的內容應該出現在<script>
標籤之間。
$('.amazon_ad').html('<scr'+'ipt type=\"text/javascript\"><!--' + ad_code + '//--></scr'+'ipt><scr'+'ipt src=\"' + window.location.protocol +'//www.assoc-amazon.com/s/ads.js\" type=\"text/javascr'+'ipt\"></scr'+'ipt>');
結果應該是第一個代碼我張貼,並顯示亞馬遜的旗幟,而不是我的瀏覽器去http://www.assoc-amazon.com/s/ads.js,應加載腳本。
有誰知道我在做什麼錯?
它被包裹在'$(函數(){'但我的document.ready和源改變了它,並得到相同的結果:(你換別的嗎? – V777 2010-10-08 18:34:18
都能跟得上一個簡單的用這個class =「amazon_ad」元素的HTML是什麼? – methodin 2010-10-08 20:50:20