zoukankan      html  css  js  c++  java
  • 脚本

      function copyImage(sImgID)
       {
          var ctrlRange = document.body.createControlRange();
          ctrlRange.add(document.all(sImgID));
          ctrlRange.execCommand("Copy");
       }

    function AddLink()
    {
     //identify selected text
     var sText = document.selection.createRange();
     if (sText.text != "")
     {
       //create link
       document.execCommand("CreateLink");
       //change the color to indicate success
       if (sText.parentElement().tagName == "A")
       {
         sText.execCommand("ForeColor",false,"#FF0033");
       }
     }
     else
     {
         alert("Please select some text!");
     }  
    }


    function printcontent {
    bdhtml=window.document.body.innerHTML;
     sprnstr="<!--startprint-->";
     eprnstr="<!--endprint-->";
     prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
     prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
     window.document.body.innerHTML=prnhtml;
     window.print();

    }

    var sInitColor = null;
    function callColorDlg(){
     
    if (sInitColor == null)
     //display color dialog box
     var sColor = dlgHelper.ChooseColorDlg();
    else
     var sColor = dlgHelper.ChooseColorDlg(sInitColor);
     //change decimal to hex
     sColor = sColor.toString(16);
     //add extra zeroes if hex number is less than 6 digits
    if (sColor.length < 6) {
      var sTempString = "000000".substring(0,6-sColor.length);
      sColor = sTempString.concat(sColor);
    }
     //change color of the text in the div
     oDiv.style.color= sColor;
     sInitColor = sColor;
     
    }
     //This variable must have global scope for the callColorDlg function to persist the chosen color
    var sInitColor = null;
    function callColorDlg(){
    //if sInitColor is null, the color dialog box has not yet been called
    if (sInitColor == null)
     var sColor = dlgHelper.ChooseColorDlg();
    else
    //call the dialog box and initialize the color to the color previously chosen
     var sColor = dlgHelper.ChooseColorDlg(sInitColor);
    //change the return value from a decimal value to a hex value and make sure the value has 6
    //digits to represent the RRGGBB schema required by the color table
     sColor = sColor.toString(16);
    if (sColor.length < 6) {
      var sTempString = "000000".substring(0,6-sColor.length);
      sColor = sTempString.concat(sColor);
    }
     document.execCommand("ForeColor", false, sColor);
     
    //set the initialization color to the color chosen
     sInitColor = sColor;
     
    }

  • 相关阅读:
    重读APUE(7)-link/unlink与mkdir/rmdir
    重读APUE(6)-umask
    社交系统中用户好友关系数据库设计
    修改Web项目的名称后,在TomCat中部署项目,项目的名称还是与原来相同的解决方案
    域名解析TTL是什么意思 TTL值设置为多少合适?
    mysql权限控制—新建用户允许其远程连接
    毕业设计技术方向(转载)
    统一资源定位符URL的组成
    开发中model,entity和pojo的区别
    要不要签三方协议
  • 原文地址:https://www.cnblogs.com/BlogNetSpace/p/1435567.html
Copyright © 2011-2022 走看看