使用Javascript向页面添加图像,该Javascript也使用延迟加载类型功能

使用Javascript向页面添加图像,该Javascript也使用延迟加载类型功能,javascript,javascript-events,Javascript,Javascript Events,我正在尝试使用一点Javascript将BBB和McAfee徽标添加到我们的结账页面的账单和付款部分。我已经写了一行代码,但是,它只有在刷新页面时才起作用。由于所有活动都发生在一个页面中,并且每次单击“继续”时都会重新加载该页面,因此我不确定为什么我写的内容不起作用。我做错了什么 $document.readyfunction{ $payment h3.prepend'trustIcons1{位置:绝对;右侧:0;顶部:-5px;}'; }; 我认为您需要在html或style前面加上前缀,或者

我正在尝试使用一点Javascript将BBB和McAfee徽标添加到我们的结账页面的账单和付款部分。我已经写了一行代码,但是,它只有在刷新页面时才起作用。由于所有活动都发生在一个页面中,并且每次单击“继续”时都会重新加载该页面,因此我不确定为什么我写的内容不起作用。我做错了什么

$document.readyfunction{ $payment h3.prepend'trustIcons1{位置:绝对;右侧:0;顶部:-5px;}';
}; 我认为您需要在html或style前面加上前缀,或者两者都加上,现在您需要在字符串前面加上前缀

$(document).ready(function(){ $("#payment h3").prepend('<div id="trusticons">your other css</div>'); })(); 

$(document).ready(function(){ $("#payment h3").prepend('<style>your css</style>'); })();

$(document).ready(function(){ $("#payment h3").prepend('<style>your css</style><div id="trusticons">your other css</div>'); })(); 

$document.readyfunction{$payment h3.prepend'trustIcons1{位置:绝对;右侧:0;顶部:-5px;};}$document.readyfunction{$payment h3.prepend'trustIcons1{位置:绝对;右侧:0;顶部:-5px;}‌​'; }; 这就是我现在使用的不起作用的东西。我不知道为什么在我的问题中代码会这样粘贴。