2006/04/10 | 网页内容另存为
类别(WEB相关) | 评论(2) | 阅读(44) | 发表于 14:57
<html>
<head>
<title>
</title>
<script language="javascript">
//将该网页保存到本地盘的其它目录!
function SaveAsMe() {
try
{
document.execCommand ("SaveAs",true,"a.xls");
}
catch(e)
{
alert("您的浏览器版本太低,请升级您的浏览器!");
}
}
//SaveAsMe();
</script>
</head>
<body>
  <a href="#" onClick="SaveAsMe()">另存为</a>
</body>
</html>
-------------------------------------
<input type="button" value="Save" onclick="SaveText()">
<script>
//Written by 灰豆宝宝.net
function SaveText()
{
//取得id=tb的表格的HTML代码.
var strHTML = tb.outerHTML;
var winSave = window.open();
winSave.document.open ("text/html","gb2312");
winSave.document.write (strHTML);
winSave.document.execCommand ("SaveAs",true,"table.htm");
winSave.close();
}
</script>
<table id="tb">
<tr><td>tttttttt</td></tr>
<tr><td>tttttttt</td></tr>
</table>
---------------------------------------------
<html>
<head>
<title>
</title>
<script language="javascript">
function SM() {
window.clipboardData.setData("Text", document.documentElement.outerHTML);
}
//SaveAsMe();
</script>
</head>
<body>
  <a href="#" onClick="SM()">复制到粘贴板</a>
</body>
</html>
-------------------------------------------------
0

评论Comments