Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good morning, i have using Zeroclipboard to copy information of 2 iframes to clipboard and i can't do it. I want that if i click in iframe "a" it copy the information of that iframe to clipboard and for the other iframe "a1" the same. But it only copy's me one information, i can't get put the code to copy one or another where i click it only copys one information independently if i click on iframe "a" or iframe "a1". If anyone can helps me i apprecciate.


HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="jquery,ui,easy,easyui,web">
<meta name="description" content="easyui help you build your web page easily!">
<title>Async Tree - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<div style="width: 300px; float: left;">        
         <ul id="tt" class="easyui-tree" url="get_tree_data_id_div.php" data-options="animate:true" >
         </ul>
</div>
<!-- A IFRAME CARREGA A SRC ATRAVES DO PHP-->
<iframe id="a" class="teste" style="float: left; width: 500px; height: 225px; visibility: hidden; background-color: #CCCCCC;" src='load_url_db_div.php'>
</iframe>
<iframe id="a1" class="teste" style="float: right; width: 500px; height: 225px; visibility: hidden; background-color: #CCCCCC;" src='load_url_db_div2.php'>     
</iframe>
<button class="button" onclick="new_tab();" ><span class="icon">Open in window</span></button>
<script language="Javascript" type="text/javascript">
//TORNA A IFRAME VISIVEL
var url;
var node;
a = 0;
$('#tt').tree({
onclick: function(){
         console.log("Entrou na funçao..");
         $("#a").css("visibility", "visible");
         $("#a1").css("visibility", "visible");
         node = $('#tt').tree('getSelected');   
         console.log("Selecionou o no..");
         $("#a").attr('src', "load_url_db_div.php?id=" + node.id);
         $("#a1").attr('src', "load_url_db_div2.php?id=" + node.id);
         url = "load_url_db_div.php?id=" + node.id;
         console.log("URL = " + url);
         console.log("ID do no selecionado: " + node.id);
}
});
function new_tab()
{
if(a !== node.id)
{a++;
console.log("Entrou na funcao do tab..");
window.open(url, a, "height=200,width=500");
}
};
</script>
<script src="ZeroClipboard.min.js" type="text/javascript"></script>
<script type="text/javascript">

         var clip = new ZeroClipboard(document.getElementById("a"),{
                 moviePath: "ZeroClipboard.swf"
         } );
                 clip.on( 'dataRequested', function ( client, args ) {
                 console.log("entrou na funcao");       
                 var frameObjb = document.getElementById("a");
                 var frameDocb = (frameObjb.contentWindow || frameObjb.contentDocument);
                 if(frameDocb.document)
                 {
                         console.log("entrou no if");
                         frameDocb = frameDocb.document;
                         frameObjbb = frameDocb.getElementById("pergunta").value;
                         clip.setText(frameObjbb);
                         console.log(frameObjbb);
                 }
                 }
                 );
                 clip.on( 'complete', function(client, args) {}
                 );
</script>
</body>
</html>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900