You can try something like this:
<script>
function createDocument()
{
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var docLib = web.get_lists().getByTitle("Docs");
var rootFolder = docLib.get_rootFolder();
clientContext.load(rootFolder);
var files = rootFolder.get_files();
clientContext.load(files);
clientContext.executeQueryAsync(
function()
{
files.addTemplateFile(rootFolder.get_serverRelativeUrl() + "/foo.docx", 0);
clientContext.executeQueryAsync();
},
function(sender, args){alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());}
);
}
</script>
<div><a href="javascript:void(0)" onclick="createDocument()">Create Document</a></div>