1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<!DOCTYPE html>
<
html
>
<
head
>
<
script
src
=
"jslib/html2canvas.js"
></
script
>
</
head
>
<
body
>
<
h1
>this is just the test ... </
h1
>
<
img
src
=
"http://www.baidu.com/img/bd_logo1.png"
/>
<
input
type
=
"button"
value
=
"screenshots"
id
=
"screenshotsBtn"
/>
<
script
>
var screenshotsBtn = document.getElementById("screenshotsBtn");
screenshotsBtn.onclick = function(event){
event.preventDefault();
html2canvas(document.body, {
allowTaint: true,
taintTest: false,
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
};
</
script
>
</
body
>
</
html
>
|
github地址:http://html2canvas.hertzen.com/
本文转自 antlove 51CTO博客,原文链接:http://blog.51cto.com/antlove/1694822