如下代码: //指定页面区域内容导入Word
function AllAreaWord()
{
var oWD = new ActiveXObject("Word.Application");
var oDC = oWD.Documents.Add("",0,1);
var oRange =oDC.Range(0,1);
var sel = document.body.createTextRange();
sel.moveToElementText(testa);
sel.select();
sel.execCommand("Copy");
oRange.Paste();
oWD.Application.Visible = true;
//window.close();
} 这段代码是用来将当前id=testa的对象的html内容,复制到一个word文档中我想请问的就是,如果这个testa是个变量str,应该怎么表达呢?
function AllAreaWord()
{
var oWD = new ActiveXObject("Word.Application");
var oDC = oWD.Documents.Add("",0,1);
var oRange =oDC.Range(0,1);
var sel = document.body.createTextRange();
sel.moveToElementText(testa);
sel.select();
sel.execCommand("Copy");
oRange.Paste();
oWD.Application.Visible = true;
//window.close();
} 这段代码是用来将当前id=testa的对象的html内容,复制到一个word文档中我想请问的就是,如果这个testa是个变量str,应该怎么表达呢?
<div id="str1">AAAAAA</div>
<div id="str2">BBBBBB</div>
……要求是将不同的内容来生成word,js代码中的testa是变化的