简体   繁体   English

我不知道为什么我的JavaScript无法正常工作…我正在将值动态传递给标签

[英]I can't figure out why my javascript isn't working… I'm dynamically passing values to a tag

I have the below code: 我有以下代码:

 <html>
 <body>

 <script>
 var Orderid = 12345;
 var Quantity = 2;
 var Revenue = 10.50;
 var Red = NorthAmerica;
 var Blue = Canada;
 var Green = French;
 var Yellow = 20.00;

 document.write('<s' + 'cript language="JavaScript" src="http://jact.atdmt.com/jaction/JavaScriptTest/v3/ato.' + Orderid + '/[atm1.' + Quantity + '/atm2.' + Revenue + '/atc1.' + Red + '/atc2.' + Blue + '/atc3.' + Green + '/atc4.' + Yellow + ']"></s'+'cript>')

 document.write('<nos' + 'cript><iframe src="http://iact.atdmt.com/iaction/JavaScriptTest/v3/ato.' + Orderid + '/[atm1.' + Quantity + '/atm2.' + Revenue + '/atc1.' + Red + '/atc2.' + Blue + '/atc3.' + Green + '/atc4.' + Yellow + ']" width="1" height="1" frameborder="0" scrolling="No" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0"></iframe></nosc' + 'ript>')
 </script>

 </body>
 </html>

The purpose of this is to pass variables to a URL (action tag) for tracking on a webpage. 这样做的目的是将变量传递到URL(操作标记)以在网页上进行跟踪。

I've always done it like this in the past, but for some reason my action tag (jact.atdmt.com or iact.atdmt.com) is not being called this time. 过去,我一直这样做,但是由于某种原因,这次没有调用我的动作标签(jact.atdmt.com或iact.atdmt.com)。 Am I doing something wrong that I'm not catching? 我做错什么了吗? Ideally I would like to keep using the same format as above... I just can't think of why it would not be working. 理想情况下,我想继续使用与上述相同的格式...我只是想不出为什么它不起作用。

Thanks, 谢谢,

You need quotes around those strings or else they will be treated as undefined variables... 您需要在这些字符串周围加上引号,否则它们将被视为未定义的变量...

var Red = 'NorthAmerica';
var Blue = 'Canada';
var Green = 'French';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我无法弄清楚为什么我添加事件处理程序的简单尝试无效 - I can't figure out why my simple attempt at adding an event handler isn't working 经典的元音练习。 我不知道为什么我的for循环无法正常工作 - classic vowel exercise. I can't figure out why my for loop isn't working 我不知道为什么我的石头,剪刀布游戏中的得分不起作用 - I can't figure out why the scoring isn't working in my rock, paper, scissors game 我有编程经验,但是对Javascript还是陌生的,无法弄清楚为什么我的代码无法运行 - I'm experienced with programming but new to Javascript, can't figure out why my code won't run 我的javascript函数似乎无法正常工作。 我不知道为什么 - My javascript function doesn't seem to be working. I can't figure out why 似乎无法弄清楚为什么我的JavaScript无法在IE和Chrome中运行 - Can't seem to figure out why my javascript isn't working in IE and Chrome 无法弄清楚为什么javascript无法在我的php文件中工作 - Can't figure out why javascript isn't working in my php file 我不知道我的 JavaScript 函数不起作用 - I can't figure out my JavaScript function is not working 我的简单路由无法正常工作,我不知道为什么 - My simple routing is not working and I can't figure out why 我的 javascript 验证刚刚停止工作,我不知道为什么 - My javascript validation just stopped working and I can't figure out why
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM