<table width="100" border="1" id="tbl">
<tr>
<td>111</td>
</tr>
<tr>
<td>222</td>
</tr>
<tr>
<td>3333</td>
</tr>
<tr>
<td>4444</td>
</tr>
<tr>
<td>5555</td>
</tr>
</table>
<script language="javascript">
function getcontent()
{
document.write(document.getElementById("tbl").innerText);
}
</script>
<input type="button" value="获取" onclick="getcontent()" />
<tr>
<td>111</td>
</tr>
<tr>
<td>222</td>
</tr>
<tr>
<td>3333</td>
</tr>
<tr>
<td>4444</td>
</tr>
<tr>
<td>5555</td>
</tr>
</table>
<script language="javascript">
function getcontent()
{
document.write(document.getElementById("tbl").innerText);
}
</script>
<input type="button" value="获取" onclick="getcontent()" />
解决方案 »
- 华丽的Doodle Cards。挑战你的浏览器渲染极限!
- 走投无路,请各位帮忙看一下代码哪里出了问题
- 求教unescape后中文变成乱码的问题
- 求一个简单的js弹出框效果
- Javascript 类扩展问题
- window.open 打开的窗口 直接最小化
- 求救:怎么用JavaScript选取用户输入的关键字所在的在的文章中的段落,正则表达式!
- FileSystemObject读由WORD另存为的XML时中文乱码问题
- 各路高手看一看,在线等待
- 如何利用js遍历文件夹(文件为html),并在另一页html页面上显示所有html文件Title,并显示超连指向该文件!
- onclick="return on()";当on()返回flase,回怎样?那返回为true,又会怎么样?
- fire下无法如何获取框架ID
http://www.huoho.com/search/ 的结果存档也是这样实现,原理是先新建一个空白文档,在把内容写上去,再执行保存命令。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head> <body>
头部内容<div id="content">试题内容</div><button onclick="CmdSave();">保存试题</button>页底内容 <script language="JavaScript">
<!--
function CmdSave()
{
var OW = window.open('','','');
var DD = new Date();
OW.document.open();
OW.document.write(document.getElementById("content").innerHTML);
OW.document.execCommand ("SaveAs",true,"试题存档-"+ DD.getYear() + "-" + DD.getMonth() + "-" + DD.getDate() + "-" + DD.getHours() + "-" + DD.getMinutes() +".htm");
OW.close();
}
//-->
</script>
</body>
</html>
===========关于使用脚本的html文件内容保存
吧向要的内容写进去
然后保存那个iframe