重说:是某个框架中,某个DIV的内容,可以做到吗

解决方案 »

  1.   

    其中APP为Div的ID
    function PrintFile()
    {
    var strResult=window.confirm("确认用Word打印吗?");
    if(strResult)
    {
    App.focus();
    document.execCommand("SelectAll");
    document.execCommand("Copy");
    App.focus();
    var WordApp=new ActiveXObject("Word.Application");
    WordApp.Application.Visible=true;
    var Doc=WordApp.Documents.Add();
    Doc.Activate();
    Doc.Content.Paste();
    Doc.PrintPreview();
    WordApp.DisplayAlerts=false;
    Doc.Close();
    WordApp.DisplayAlerts=true;
    WordApp.Quit();
    }
    else
    {
    var hwnd=window.open("");
    hwnd.document.write(App.innerHTML);
    }
    return false;
    }