JavaScript另存代码的问题
<html><head><style type="text/css"><!-- textarea{ width:500px; height:150px; border:1px solid #000; border-right:1px solid #C2C2C2; border-bottom:1px solid #c2c2c2; } --></style><script language="javascript"><!-- function save(){ var tcode=document.getElementById('code').value; document.execCommand('SaveAs','','code.html'); } --></script></head><body> <textarea id="code"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html> <head> <title>HTML Template</title> <style text="text/css"> <!-- #layout{ margin:0px auto; background-color:#ccc; border:2px solid #333; width:300px; height:300px; } --> </style> </head> <body> <div id="layout">1列固定宽度</div> </body></html> </textarea> <br> <button onclick="save()">另存代码</button></body></html>