Canvas to dataURL to CSS

This page's background is set to a checkerboard pattern, which is rendered using HTML5 Canvas.

window.onload=function(){
var cv=document
.getElementsByTagName("canvas")[0];

var cx=cv.getContext("2d");
cx.fillStyle="#fed";
cx.fillRect(0,0,32,32);
cx.fillRect(32,32,32,32);

document.documentElement
.style.backgroundImage
="url("+cv.toDataURL()+")";
};