code: function doSave(obj) {
      var winname = window.open('', '_blank', 'top=10000');
      winname.document.open('text/html', 'replace');
      winname.document.writeln(obj.value);
      winname.document.execCommand('saveas', '', 'code.htm');
      winname.close();
  }
docs: 另存代码