我的Javascript数组内容如下所示
Order[0] = Order ID
Order[1] = Unused
Order[2] = Payment Amount
我想传递以下参数oid = Order [0]& amt =订单[2]到以下
<img src="https://gan.doubleclick.net/gan_conversion?advid=K123456&oid=12345&amt=123.45" width=1 height=1>
我已编写此代码,但它无法正常工作
<script> document.write('<img src="https://gan.doubleclick.net/gan_conversion?advid=K539002&oid=+%Order[0]%+&amt=+%Order[2]%" width=1 height=1>')</script>
不确定是什么问题
答案 0 :(得分:1)
您需要正确连接值:
<script>
document.write('<img src="https://gan.doubleclick.net/gan_conversion?advid=K539002&oid=' + Order[0] + ' &amt=' + Order[2] + "' width="1" height="1" />')
</script>