var winname = window.open('', '_blank', 'top=10000')
winname.document.open('text/html', 'replace')
winname.document.write(obj.value)
winname.document.execCommand('saveas','','test.htm')
winname.close()
}
js脚本在html中批量加入图片,我们需要设置一个父类的div,然后在创建子类,在创建好一个img的子类,将图片都添加进来,<html>
<body>
<div id='parent'>
<div class='pin'>
</div>
</div>
</body>
<script>
var oPin = document.createElement('div')
oPin.className = 'pin'
oParent.appendChild(oPin)
var oImg = document.createElement('img')
loadImg('./image/'+ data[i].src,callBack,oImg) //这里是你的图片地址
oImg.src = './image/'+ data[i].src
oPin.appendChild(oImg)
</script>
</html>