Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/07/2013, 10:40
Avatar de jibran
jibran
 
Fecha de Ingreso: mayo-2011
Ubicación: Estado de Mexico
Mensajes: 27
Antigüedad: 13 años
Puntos: 0
Respuesta: Copiar con ZeroClioboard

ya lo resolvi gracias si utilice ZeroClipboard!!!

EL problema era....

Que el contenido disponible en las paginas no sirve en especififico la el script ZeroClipboar.js,

ni siquiera se encuntra disponible en google code... pero por fortuna al leer el script me percate de que habian cosas que faltaban para que pudiera creaser un lemento ZeroCLip con mediante el contructur new ZeroClip....


El scrip queda como sigue

tambien dejo el html ejemplo


Código HTML:
Ver original
  1.     <title>Zero Clipboard Test JB or die</title>
  2.     <style type="text/css">
  3.         body { font-family:arial,sans-serif; font-size:9pt; }
  4.        
  5.         .my_clip_button { width:150px; text-align:center; border:1px solid black; background-color:#ccc; margin:10px; padding:10px; cursor:default; font-size:9pt; }
  6.         .my_clip_button.hover { background-color:#eee; }
  7.         .my_clip_button.active { background-color:#aaa; }
  8.     </style>
  9.     <script type="text/javascript" src="ZeroClipboard.js"></script>
  10.     <script language="JavaScript">
  11.         var clip = null;
  12.        
  13.         function $(id) { return document.getElementById(id); }
  14.        
  15.         function init() {
  16.                      alert("after init ");
  17.             clip = new ZeroClipboard.Client();
  18.                         alert("after init an created class");
  19.             clip.setHandCursor( true );
  20.            
  21.             clip.addEventListener("load", function (client) {
  22.                 debugstr("Flash movie loaded and ready.");
  23.             });
  24.            
  25.             clip.addEventListener('mouseOver', function (client) {
  26.                 // update the text on mouse over
  27.                 clip.setText( $('fe_text').value );
  28.             });
  29.            
  30.             clip.addEventListener('complete', function (client, text) {
  31.                 debugstr("Copied text to clipboard: " + text );
  32.             });
  33.            
  34.             clip.glue( 'd_clip_button', 'd_clip_container' );
  35.         }
  36.        
  37.         function debugstr(msg) {
  38.             var p = document.createElement('p');
  39.             p.innerHTML = msg;
  40.             $('d_debug').appendChild(p);
  41.         }
  42.     </script>
  43. </head>
  44. <body onLoad="init()">
  45.     <h1>Zero Clipboard Test jb or die</h1>
  46.     <p><script>document.write("Your browser: " + navigator.userAgent);</script></p>
  47.     <table width="100%">
  48.         <tr>
  49.             <td width="50%" valign="top">
  50.                 <!-- Upload Form -->
  51.                 <table>
  52.                     <tr>
  53.                         <td align="right"><b>Text:</b></td>
  54.                         <td align="left"><textarea id="fe_text" cols=50 rows=5 onChange="clip.setText(this.value)">Copy me!</textarea></td>
  55.                     </tr>
  56.                 </table>
  57.                 <br/>
  58.                 <div id="d_clip_container" style="position:relative">
  59.                     <div id="d_clip_button" class="my_clip_button"><b>Copy To Clipboard...</b></div>
  60.                 </div>
  61.             </td>
  62.             <td width="50%" valign="top">
  63.                 <!-- Debug Console -->
  64.                 <div id="d_debug" style="border:1px solid #aaa; padding: 10px; font-size:9pt;">
  65.                     <h3>Debug Console:</h3>
  66.                 </div>
  67.             </td>
  68.         </tr>
  69.     </table>
  70.    
  71.     <br/><br/>
  72.     You can paste text here if you want, to make sure it worked:<br/>
  73.     <textarea id="testarea" cols=50 rows=10></textarea><br/>
  74.     <input type=button value="Clear Test Area" onClick="$('testarea').value = '';"/>
  75. </body>
  76. </html>