• javascript操作粘贴板


    <body MS_POSITIONING="GridLayout">
            
    <script type="text/javascript"> 
       
    <!-- 
       
    function clip(text){   
       
    //str=eval("document.getElementById('copy1')"); 
       //str.select(); 
       //str = document.selection.createRange(); 
       //clipboardData.setData('text',(str.text)); 
       var sel = document.body.createTextRange();
                sel.moveToElementText(document.getElementById(
    'copy'));//此处form是页面form的id
                sel.select();
                sel.execCommand(
    "Copy");
       }
     
       
    //--> 
            
    </script>
            
    <form id="Form1" method="post" runat="server">
                
    <href="javascript:clip()">复制到剪贴板</a><br>
                
    &nbsp;
                
    <asp:Label id="copy" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 96px" runat="server">2<sup>
                        2
    </sup></asp:Label>
            
    </form>
        
    </body>
    1.首先用后台语言从数据库里读取数据
    2.把从数据库里读取到的数据用javascript操作付到页面中去。
    eg:
    function replaceDate()
                
    {                
                    
    if(isNewSign=="none")
                    
    {                                
                        
    if(TANGER_OCX_OBJ!="")
                        
    {
                            var myDocApp
    =TANGER_OCX_OBJ;                    
                            
    //****************Word替换文字型窗体区域书签内容*******************
                            
    //只能替换一次                    
                            myDocApp.ActiveDocument.FormFields("recfilecode").Range = recfilecode;             
                            myDocApp.ActiveDocument.FormFields(
    "recfileno").Range = recfileno;
                            myDocApp.ActiveDocument.FormFields(
    "recfilemj").Range = recfilemj;
                            myDocApp.ActiveDocument.FormFields(
    "recfileyear").Range = recfileyear;
                            myDocApp.ActiveDocument.FormFields(
    "recfilemonth").Range = recfilemonth;
                            myDocApp.ActiveDocument.FormFields(
    "recfileday").Range = recfileday;
                            myDocApp.ActiveDocument.FormFields(
    "recfiletitle").Range = recfiletitle;
                            myDocApp.ActiveDocument.FormFields(
    "recfileunite").Range = recfileunite;
                            
                        
                    }

                }
    说明:1)FormFields是word中的属性,
    2)ActiveDocument(NTKO中的属性):返回文档对象的自动化接口
    3)("recfilecode")为word摸板中的字段名 
  • 相关阅读:
    linux系统中批量对一类文件重命名
    hdu4751 Divide Groups
    tyvj1614 魔塔魔塔!
    noip2012 疫情控制
    黄学长模拟day1 大逃亡
    黄学长模拟day1 球的序列
    黄学长模拟day1 某种密码
    约瑟夫问题及其变形
    秦皇岛 I 题
    暴力搜索 + 剪枝
  • 原文地址:https://www.cnblogs.com/sunheyubo/p/1134949.html
Copyright © 2020-2023  润新知