在WEB页上,如果将数据库里内容另存于DOC文档
WEB页另存于DOC文档的疑问http://www.lawyee.com/bin/DownloadToDoc.asp这个文件的代码是什么可以知道吗?
请高手支招!!!
//***************另存于DOC文档*****************//
function fnDownloadDoc(){
var node;
var fromObj = document.getElementById('frmDownloadToDoc');
if (fromObj==undefined){
node = document.createElement('form');
node.action = 'http://www.lawyee.com/bin/DownloadToDoc.asp';
node.method = 'post';
node.name = 'frmDownloadToDoc';
document.appendChild(node);
fromObj = node;
}
for (var i=0; i<fromObj.elements.length; i++){fromObj.removeChild(fromObj.elements);}
var iCount;
var strData;
var iMaxChars = 50000;
var iBottleNeck = 2000000;
var strHTML;
strData = document.getElementById('Matter').innerHTML;
strData = strData.replace(/<div id=ItemCorrelation.*?>.*?<\/div>/ig, '');
strData = strData.replace(/<a.*?>(.*?)<\/a>/ig, '$1');
iCount = parseInt(strData.length / iMaxChars) + 1;
node = document.createElement('input');
node.type = 'hidden';
node.name = 'File_Name';
if (document.getElementById('File_Name')!=undefined){
node.value = document.getElementById('File_Name').innerText;
}else{node.value = "temp";}
fromObj.appendChild(node);
for (var i=1; i <= iCount; i++){
node = document.createElement('input');
node.type = 'hidden';
node.name = 'strItemContent';
node.value = strData.substring((i - 1) * iMaxChars, i * iMaxChars);
fromObj.appendChild(node);
}
fromObj.submit();
}
这是JS代码
浏览页面的写法。
<tr><td id="Matter">
<p align=center><b id=File_Name>文章标题</p>
<p>文章内容</p>
</td></tr>
<tr><td id="File_Name" style="display:none">文章标题</td></tr>
另外,http://law.chinalawinfo.com/Newlaw2002/SLC/SLC.asp?Db=chl&Gid=75166在这个页面的下载1 下载2,是如何实现的?谢谢!!
参考答案:response.contentType="application/vad.ns-word"
把他加在程序里,具体自己试试