Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    589

    copiare testo in memoria con un pulsante

    salve a tutti , volevo avere un suggerimento su come inserire in memoria del testo presente in un form preimpostato che non trasmette nessun dato, mi spiego: ho una normalissima pagina html o php nella quale si vede del testo racchiuso in un campo testo con varie righe di testo. vorrei accanto al campo form un pulsante che copia il testo in memoria......... da copiare poi dove voglio io .

  2. #2
    occorre javascript e mi pare che alcuni browser possono far casini (con "incolla" sicuro)

    http://www.frontpagewebmaster.com/m-185852/tm.htm

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    589
    grazie funziona ..... per correttezza metto la paginetta semplice funzionante.......solo con explorer mi funziona il riquadro 150x162 e negli altri browser il testo è tutto in orizzontale per esteso . grazie ancora


    codice:
    <html>
    
    <head>
    <title>Scegli la sezione giusta e premy copy </title>
    <meta name="generator" content="Namo WebEditor v5.0">
    
    <SCRIPT LANGUAGE="JavaScript">
    
    function ClipBoard() 
    {
    holdtext.innerText = copytext.innerText;
    Copied = holdtext.createTextRange();
    Copied.execCommand("Copy");
    }
    
    </SCRIPT>
    
    
    
    </head>
    
    <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
    
    <SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">This text will be copied onto the clipboard when you click the button below. Try it!
    
    </SPAN><TEXTAREA ID="holdtext" STYLE="display:none;">
    </TEXTAREA>
    <BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
    
    
    </p>
    </body>
    
    </html>

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    589
    a una modifica , come faccio a far in modo che il testo va a capo cioè quando faccio incollo lo trovo cosi e non tutto esteso



    This text will be copied
    onto the clipboard when

    you click the button

    below. Try it!

  5. #5
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    589
    ho trovato la soluzione la posto per tutti in questo codice che funziona :

    codice:
    <html>
    
    <head>
    <title>Here is some text you can copy. You can copy text from anywhere on the page, simply select it and press the Copy to clipboard b</title>
    <meta name="generator" content="prova">
    
    
    <script type="text/javascript">
    
    function CopyToClipboard()
    
    {
    
       document.Form1.txtArea.focus();
    
       document.Form1.txtArea.select(); 
    
       CopiedTxt = document.selection.createRange();
    
       CopiedTxt.execCommand("Copy");
    
    }
    
    </script>
    
    </head>
    
    <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
    
    
    
    <form name="Form1">
    
    Here is some text you can copy. You can copy text from anywhere on the page, simply select it and press the Copy to clipboard button. Then you can paste it anywhere you want, in Notepad, Visual Studio or in the textarea below.
    
    
    
    
    
    <textarea id="txtArea" cols="60" rows="5">testo prova che si evidenzia e va in memoria    You can also copy text from this textarea.
    spazi 
     Or you can paste the text here, using the Ctrl+V key
     spazi a capo
     [img][/img]
     va a capo 
     
      combination.</textarea>
    
    
    
    
    <input type="button" onClick="CopyToClipboard()" value="Copy to clipboard" />
    
    </form>
    
    
    
    </p>
    </body>
    
    </html>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.