我不知道javascript,我一直在到处寻找这个答案。我想在我的页面中复制内容。html 和内容直接来自代理。
想要的结果是:
Click the button to change the text in this paragraph.
Click the button to change the text in this paragraph.
我的 HTML 是:
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to change the text in this paragraph.</p>
<script language="javascript" type="text/javascript">
var elem = document.getElementById('demo').setAttribute('id', 'nextstep');
document.write(elem);
</script>
</body>
</html>
我得到的是:
Click the button to change the text in this paragraph.
undefined
有人可以帮我指出正确的方向吗?提前致谢!