我正在使用它将文本复制到剪贴板..
http://www.steamdev.com/zclip/
我试过这样,但是我无法将复制的文本复制到剪贴板中。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery.zclip.js"></script>
<script>
$(document).ready(function(){
$('textarea#showthis').zclip({
path:'js/ZeroClipboard.swf',
copy:function(){return $('#showthis').val();}
});
});
function myfunc2()
{
var selectedobj=document.getElementById('showthis');
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>
</head>
<body>
<label onclick="myfunc2()">Click here</label>
<textarea id="showthis" style="display:none" class="hide" readonly>hi, how are you?</textarea>
</body>
</html>
请告诉我出了什么问题! (我不知道javascript和jquery的东西!)
答案 0 :(得分:1)
function myfunc2() {
if($('#showthis').css('display') == 'none'){
$('#showthis').show().removeClass('hide').addClass('show');
}else{
$('#showthis').hide().removeClass('show').addClass('hide');
}
}