<html>
<head>
<title>无标题文档</title>
</head>
<body>
<form name="form1" method="post" action="">
<input type="text" name="textbox1">
<input type="button" name="btn1" value="按钮" onClick="savefile('newfile.txt',this.form.textbox1.value)">
</form>
<script language="JavaScript" type="text/javascript">
function savefile(SaveFileName,data)
{
var newWin = window.open("","DownLoad","");
newWin.document.write(data)
newWin.document.execCommand('Saveas',true, SaveFileName);
newWin.window.close();
}
</script>
</body>
</html>
温馨提示:答案为网友推荐,仅供参考