我想在网页中添加一个javascript谷歌广告,但我无法使用jquery将javascript插入到div中。我试图用这个测试模拟我的问题,这是使用我在stackoverflow上找到的一些建议,但它不起作用。
我想要插入
以下是代码:
感谢您的回答,
卢卡斯
我想要插入
<script type='text/javascript'>document.write('hello world'); </ script>
到div中,并在tag_1和tag_2之间显示“hello world”。以下是代码:
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var str="<script type='text/javascript'>document.write('hello world');";
str+="<";
str+="/script>";
$('#insert_here').append(str);
});
</script>
</head>
<body>
tag_1<br/>
<div id="insert_here">
</div>
tag_2<br/>
</body>
</html>
感谢您的回答,
卢卡斯