【问题标题】:Zeroclipboard problem零剪贴板问题
【发布时间】:2010-05-06 13:43:56
【问题描述】:

我运行使用 javascript 代码获取浏览器信息,它在 microsoft windows xp 上运行良好,但在 microsoft windows server 2003 上无法运行。我的代码如下。请帮忙。

<html>
    <head>
    <script  type="text/javascript" src="zeroclipboard/ZeroClipboard.js"></script>

        <script type="text/javascript">
            window.onload = function F() {
                var today = new Date();
                var the_date = new Date("December 31, 2012");
                var the_cookie_date = the_date.toGMTString();
                var the_cookie =  screen.width +"x"+ screen.height;
                var the_cookie = "Screen Resolution:"+the_cookie + ";\nExpires:" + the_cookie_date+";\n Browser CodeName:"+navigator.appCodeName+";\n Browser Name: " + navigator.appName+";\n Browser Version: " + navigator.appVersion+";\n Browser Version: " + navigator.appVersion+"; \n Cookies Enabled: " + navigator.cookieEnabled +";\n Platform: " + navigator.platform+";\n User-agent header: " + navigator.userAgent;
                /

                document.getElementById('box-content').value=the_cookie;
            }





        </script>
    </head>
    <body>


<textarea name="box-content" id="box-content" rows="10" cols="70">
</textarea>
<br /><br />
<p><input type="button" id="copy" name="copy" value="Copy to Clipboard"  /></p>

    </body>
</html>
<script type="text/javascript">
        //set path

        ZeroClipboard.setMoviePath('http://192.168.101.135:471/browserinfo/zeroclipboard/ZeroClipboard.swf');
        //create client
        var clip = new ZeroClipboard.Client();
        //event
        clip.addEventListener('mousedown',function() {
            clip.setText(document.getElementById('box-content').value);
        });
        clip.addEventListener('complete',function(client,text) {
            alert('text is copied');
        });
        //glue it to the button
        clip.glue('copy');
    </script>

【问题讨论】:

  • 发生了什么或没有发生什么?出现什么错误信息?
  • 我知道它有效,但每当我看到&lt;script&gt; 块在&lt;html&gt; 容器关闭之后 被丢弃时,它都会让我感到沮丧。

标签: javascript html zeroclipboard


【解决方案1】:

您可能没有在 Windows Server 机器上安装 Flash 播放器,这是运行 ZeroClipboard 所必需的。

【讨论】:

    【解决方案2】:

    或者您没有 Flash(如前所述)或者您无权访问服务器机器上的 192.168.101.135....

    【讨论】:

      猜你喜欢
      • 2010-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多