这三天,做了两个小gadget。

两个 Gadget 小程序 两个 Gadget 小程序

待办的代码:

Gadget.htm

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>我的待办</title>
<script src="jquery.js" type="text/javascript"></script>
<style>
body{margin:0px;  font-family:"微软雅黑", "宋体"; font-size:12px; color:#FFFFFF}
table,td{font-size:12px}
A:link{
    font-size:12px;
    color:#ffffff;
    text-decoration:none;
    font-family:"微软雅黑", "宋体";
    letter-spacing:5px;
    }
A:visited{
    font-size:12px;
    color:#ffffff;
    text-decoration:none;
    font-family:"微软雅黑", "宋体";
    letter-spacing:5px;
    }
A:hover{
    font-size:12px;
    color:#ffffff;
    text-decoration:none;
    font-family:"微软雅黑", "宋体";
    letter-spacing:5px;
    }
    </style>
    <script type="text/javascript">
        var openUrl;
         var hostIP = "http://localhost:9999";
        //http://10.204.32.116/ActiveChart/Chart/GadgetService.asmx
        //var hostIP = "http://10.204.32.116/ActiveChart";
        function updateChart() {

            var OAName = System.Gadget.Settings.readString("OAName");
            System.Debug.outputString(OAName); //DEBUG CODE
            var OAPass = System.Gadget.Settings.readString("OAPass");
            System.Debug.outputString(OAPass); //DEBUG CODE

            var HostName = System.Gadget.Settings.readString("HostName");
            System.Debug.outputString(HostName); //DEBUG CODE

            if (OAName != "") {
                var ipTest = hostIP + "/Chart/GadgetService.asmx/GetAllWorkSigns";
                System.Debug.outputString(ipTest); //DEBUG CODE
                var str = "";
                var count = 0;
                $.ajax({
                    type: "POST",   //访问WebService使用Post方式请求
                    contentType: "application/json", //WebService 会返回Json类型
                    url: hostIP + "/Chart/GadgetService.asmx/GetAllWorkSigns", //调用WebService的地址和方法名称组合 ---- WsURL/方法名
                    data: "{hostName:'" + "jiangguoqiang" + "',oaName:'" + OAName + "',oaPass:'" + OAPass + "'}",         //这里是要传递的参数,格式为 data: "{paraName:paraValue}",下面将会看到      
                    dataType: 'json',
                    success: function(result) {     //回调函数,result,返回值

                        $(result.d).each(function() {

                        if (count % 4 == 0) {
                            str += "<tr >";
                        }
                        System.Debug.outputString("记录信息:" + this['SignName'] + System.Gadget.Settings.readString(this['SignName']));
                        if (System.Gadget.Settings.readString(this['SignName']) == "True") {
                        str += "<td width=\"25%\" height=\"38\" align=\"center\"><div onmousedown=\"javascript:windowOpen('" + this['SignUrl'] + "');\"><img alt='" + this['SignName'] + "' src=\"images/" + this['SignName'] + ".png\" width=\"32\" height=\"32\"><br /><span height=\"15\" align=\"center\">(" + this['SignCount'] + ")</span></td>"
                        //System.Debug.outputString(str);
                        count = count + 1;
                        }

                        if (count == 4 || count == 8 || count == 12) {
                            str += "</tr>";
                        }
                        });
                        System.Debug.outputString("添加表格内容:" + str);
                        $("#tb1").html(str);
                    }
                });
            }
            else {
                $("#tb1").html("<tr><td>请点击设置功能键登陆!</td></tr>");
                System.Debug.outputString("未设置"); //DEBUG CODE
            }

            timerID = setTimeout(updateChart, 10000);
        }
        function Initialize() {
            System.Gadget.settingsUI = "options.html";
        }

        function windowOpen(url) {

            window.open(url, "NewWin", "height=524,width=1100,top=0,left=0,   toolbar=no,   menubar=no,   scrollbars=no,   resizable=no,location=no,   status=no,fullscreen=yes");

        }
    </script>
</head>

<body onload="Initialize();updateChart();"   style=" margin:0; width: 228px; height: 240px; background-repeat:no-repeat;background:url(bgbk5.png);"><div style="width:228px">

<table width="228" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="images/head_db.png" width="228" height="25"></td>
  </tr>
  <tr>
    <td height="150" valign="top" background="images/body_bk.png">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="180" background="images/body1.png" style="background-repeat:no-repeat" valign=top>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="18"></td>
            </tr>
          </table>
          <table />
            </td>
        </tr>
    </table>
</body>
</html>

相关文章:

  • 2022-02-07
  • 2021-11-21
  • 2022-02-04
  • 2021-12-03
  • 2021-12-06
  • 2021-06-17
猜你喜欢
  • 2021-09-27
  • 2021-07-03
  • 2021-07-03
  • 2022-12-23
  • 2021-06-01
  • 2022-12-23
相关资源
相似解决方案