javascript:获取道客巴巴图片链接
可以做成javascript书签,也可以直接在控制台运行。javascript:var canvases = document.getElementsByTagName('canvas');var downloadContainer = document.createElement('div');downloadContainer.id = 'xiazai';for (var i = 0; i < canvases.length; i++) { var canvas = canvases; var dataURL = canvas.toDataURL('image/png'); var a = document.createElement('a'); a.href = dataURL; a.download = 'myImage' + i + '.png'; a.textContent = 'Download Image ' + (i + 1); downloadContainer.appendChild(a); var br = document.createElement('br'); downloadContainer.appendChild(br);}document.body.insertBefore(downloadContainer, document.body.firstChild);
示例:https://www.doc88.com/p-36016424364506.html
https://imgsrc.baidu.com/forum/pic/item/91ef76c6a7efce1bd879fff7e951f3deb48f65b8.jpg
https://imgsrc.baidu.com/forum/pic/item/14ce36d3d539b6002986388aaf50352ac65cb746.jpg 本帖最后由 MakoStar 于 2024-5-3 22:38 编辑
发出来之前把文章源码类型改一下格式化一下啊
var canvases = document.getElementsByTagName('canvas');
var downloadContainer = document.createElement('div');
downloadContainer.id = 'xiazai';
for (var i = 0; i < canvases.length; i++) {
var canvas = canvases;
var dataURL = canvas.toDataURL('image/png');
var a = document.createElement('a');
a.href = dataURL;
a.download = 'myImage' + i + '.png';
a.textContent = 'Download Image ' + (i + 1);
downloadContainer.appendChild(a);
var br = document.createElement('br');
downloadContainer.appendChild(br);
}
document.body.insertBefore(downloadContainer, document.body.firstChild); 有没有办法弄成html 的文字版,可复制文字 学习一下,谢谢楼主分享 感谢分享 感谢大佬分享!又多了一种方法 下载到了哪里了? 学习一下,谢谢楼主分享 控制台用js挺方便的 收藏,感谢分享
页:
[1]
2