Good all the time of day.

The page loads the form with input'ami. The input values ​​are already pre-filled. Let us suppose:

<input name="d11" value="<? echo $d11; ?>"> <input name="d12" value="<? echo $d12; ?>"> .... <input name="d19" value="<? echo $d19; ?>"> 

Also on the page there are other input'y (belong to a different form)

 <input name="r11" value=""> <input name="r12" value=""> .... <input name="r19" value=""> 

Question: Is it possible, after loading the page, to automatically copy all the values ​​from the inputs in the first form, i.e. With emit pressing Ctrl + C, and paste the copied values ​​into the inputs in the second form?

I will explain.

  1. Of course, you can do this in the page code. So I can. I ask for another reason.
  2. You can write lightweight js code that aligns the values, where necessary, to what you need. I need to imitate this action precisely as if the person himself copied and pasted it
  3. Copy the code - not that. get a new EXACTLY equal to the copied. when you do Ctrl + C and Ctrl + V - this is not always accurate. that's what i need

ps Actually I really hope to get an answer, and I am ready to generously award experience points to the respondent.

pps Please enter the position due to the influence of black forces.

I will add after a couple of hours of tips for IE (copy only):

 <script> window.clipboardData.setData('text', 'Этот текст в буфере'); </script> // осталось дописать вставку 
  • Isn't it easier to "clone" the first form? .clone () - Deonis
  • 3
    "when you do Ctrl + C and Ctrl + V is not always exactly ..." is it like o_O? - oneboy
  • I can invite you to visit. show clearly. but please take a word. if you start simple. I load the page, I need to emit such an action that I will have a phrase in the buffer - hello to all guys !! 1. so I would not see it, and if I closed the browser, and opened any application and pressed Ctrl + V. I inserted a phrase that was automatically copied into the buffer when the page loads? it will be half what i need. - sergey
  • 2
    Sorry for the offtopic but the last comment is PPC)) - Denis Masster
  • you have Form1 and Form2. The page is loading ... the value of the input of Form1 is copied into the value of the input of Form2? - oneboy

1 answer 1

So you need to copy to the clipboard? This is judging by your last comment. What FireFox offers , and for IE:

 function copyToClipboard(s) { if (window.clipboardData && clipboardData.setData) { clipboardData.setData('text', s); } } 

Also look at this Clipboard plugin for jQuery . Also read this short article . Infa - not plowed field!

  • here for IE <script> window.clipboardData.setData ('text', 'This text is in buffer'); </ script> actually forward. Now, how to paste it to the buffer after copying it to the buffer? - sergey
  • since I did not find the insert, I think that there is no solution - sergey