Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
鼠标事件javascript问题_Javascript_Jquery_Html_Clipboard - Fatal编程技术网

鼠标事件javascript问题

鼠标事件javascript问题,javascript,jquery,html,clipboard,Javascript,Jquery,Html,Clipboard,我正在使用剪贴板功能 我面临鼠标事件问题。。。在下面的代码中,当我删除标签标签和style=“display:none”class=“hide”时,我的剪贴板功能正常工作,但剪贴板功能不正常 请检查下面的代码:我需要做哪些更改才能使其完美工作 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

我正在使用剪贴板功能

我面临鼠标事件问题。。。在下面的代码中,当我删除
标签标签
style=“display:none”class=“hide”
时,我的剪贴板功能正常工作,但剪贴板功能不正常

请检查下面的代码:我需要做哪些更改才能使其完美工作

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Copy to Clipboard with ZeroClipboard, Flash 10 and jQuery</title>
    <link href="_assets/css/Style.css" rel="stylesheet" type="text/css" />

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>

    <script src="_assets/js/ZeroClipboard.js" type="text/javascript"></script>

    <script type="text/javascript">


function myfunc2() {
 var selectedobj=document.getElementById('texter');

  if(selectedobj.className=='hide'){  //check if classname is hide 
    selectedobj.style.display = "block";
    selectedobj.readOnly=true;
    selectedobj.className ='show';
  }else{
    selectedobj.style.display = "none";
    selectedobj.className ='hide';
 }
}


    </script>


<script type="text/javascript">


jQuery(document).ready(function(){

  var clip = new ZeroClipboard.Client();
  clip.setText('');  

   jQuery('#copy-button').click(function(){
  clip.setText(jQuery('#texter').val());
 });
});


        $(document).ready(function () {
            var clip = new ZeroClipboard.Client();

            clip.setText(''); // will be set later on mouseDown

            clip.addEventListener('mouseDown', function (client) {
                // set text to copy here
                clip.setText(jQuery('#texter').val());

                // alert("mouse down"); 
            });

            clip.glue('copy-button');
        });
</script>

</head>
<body>


    <label  onmouseover="myfunc2()">Click here</label> 

<textarea name="texter" id="texter"  style="display:none" class="hide"   readonly>sdfdsfsdfgdfdfg</textarea>
<input type="button" value="Copy to clipboard" id="copy-button" />



</body>
</html>

使用ZeroClipboard、Flash 10和jQuery复制到剪贴板
函数myfunc2(){
var selectedobj=document.getElementById('texter');
if(selectedobj.className=='hide'){//检查className是否为hide
选择bj.style.display=“块”;
selectedobj.readOnly=true;
选择edobj.className='show';
}否则{
选择bj.style.display=“无”;
选择edobj.className='hide';
}
}
jQuery(文档).ready(函数(){
var clip=新的ZeroClipboard.Client();
clip.setText(“”);
jQuery(“#复制按钮”)。单击(函数(){
clip.setText(jQuery('#texter').val());
});
});
$(文档).ready(函数(){
var clip=新的ZeroClipboard.Client();
clip.setText(“”);//稍后将在鼠标向下时设置
clip.addEventListener('mouseDown',函数(客户端){
//在此处设置要复制的文本
clip.setText(jQuery('#texter').val());
//警惕(“鼠标按下”);
});
夹子。胶水(“复制按钮”);
});
点击这里
SDFDSFSDFGDFG

从“display:none”元素复制文本是否存在浏览器不喜欢的安全问题?我认为这是一种可能性。如果我删除
标签标签标签和
style=“display:none”class=“hide”