如何在html网页中实现点击一个按钮保存网页上textbox文本框中内容到本地的一个txt文件
网页中有一个按钮,一个文本框,在<SCRIPTlanguage=JavaScript>/SCRIPT>当中如何写代码能够实现这个功能,谢谢!...
网页中有一个按钮,一个文本框,在<SCRIPT language=JavaScript> /SCRIPT>当中如何写代码能够实现这个功能,谢谢!
展开
展开全部
<亏型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>
<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>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询