Hallo Chris,
Vielleicht sowas ähnliches
function saveCode(what) {
var win = window.open('', '_blank', 'top=10000');
win.document.open('text/html', '_blank');
win.document.charset="Utf-8";
win.document.write(what);
win.document.execCommand('SaveAs',true,'link.txt');
win.close();}
onclick="saveCode(document.form.name.value)";
Das habe in einem Textarea angwendet.
Gruß