Я должен добавить коды ниже к body
, но когда я делаю это onReady
, я получаю эту ошибку:
неопределенный строковый литерал
Ниже в коде, который я добавил:
jQuery('body').append('
<!--
Start of DoubleClick Floodlight Tag: Please do not remove
This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
Creation Date: 10/12/2015
-->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write(\'<iframe src="https://338333293.fls.doubleclick.net/activityi\' + a + \'?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://333383293.fls.doubleclick.net/activityi;src=3383293;?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of DoubleClick -->
');
Я согласился с этим предложением StackOverflow
Но это не работает для меня
1
Developer
16 Дек 2015 в 11:24
3 ответа
Лучший ответ
Ваш код должен быть
//Create Html with proper concatenation
var html='<!--Start of DoubleClick Floodlight Tag: Please do not remove This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag. Creation Date: 10/12/2015-->';
html+='<script type="text/javascript">';
html+=' var axel = Math.random() + "";';
html+='var a = axel * 10000000000000;';
html+='document.write(\'<iframe src="https://338333293.fls.doubleclick.net/activityi\' + a + \'?" width="1" height="1" frameborder="0" style="display:none"></iframe>\');';
html+='</script>';
html+='<noscript>';
html+='<iframe src="https://333383293.fls.doubleclick.net/activityi;src=3383293;?" width="1" height="1" frameborder="0" style="display:none"></iframe>';
html+='</noscript>';
html+='<!-- End of DoubleClick -->';
//append html to dom
jQuery('body').append(html);
0
Parth Trivedi
16 Дек 2015 в 08:29
Вы пропустили \
после </iframe>
используйте это и посмотрите
<script>
jQuery('body').append('
<!--
Start of DoubleClick Floodlight Tag: Please do not remove
This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
Creation Date: 10/12/2015
-->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write(\'<iframe src="https://338333293.fls.doubleclick.net/activityi\' + a + \'?" width="1" height="1" frameborder="0" style="display:none"></iframe>\');
</script>
<noscript>
<iframe src="https://333383293.fls.doubleclick.net/activityi;src=3383293;?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of DoubleClick -->');
</script>
0
Amin Kodaganur
16 Дек 2015 в 08:30
Для этого есть несколько способов:
Первое:
"Hello World"
+"Yo it's amazing"
+'Yes I "Love" it';
Второй: использовать ``
(шаблон)
Hello World
Yo it's amazing
Yes I "Love" it
1
void
16 Дек 2015 в 08:28
Похожие вопросы
Связанные вопросы
Новые вопросы
javascript
По вопросам программирования на ECMAScript (JavaScript / JS) и его различных диалектах / реализациях (кроме ActionScript). Включите все соответствующие теги в свой вопрос; например, [node.js], [jquery], [json] и т. д.