if i have a string of text how do i copie it to the clipboard so i can paste it into another document?
Thanks!
if i have a string of text how do i copie it to the clipboard so i can paste it into another document?
Thanks!
In PHP? I'm not sure, does php even have access to the clipboard?
As I understand you want to "steal" some text from one website and create your "own" just using a browser.
You have to create the website with text type form, copy text from clipboard into the form, correct something if it is necessary and send it to PHP script to create "your" website. If your script will be "smart" you can automatically create and store as HTML files very sophisticated sites with tables and so on.
Gregor63
Uhh no, i dont want to "steal" anything. I am calling info from a database and storing it in a variable.
I basically want to make a link/button that says "Click Here To Copy This List" Adn then it is copied to the clipboard and theya re able to paste it wherever they want... I found some odd examples of javascript but nothing specific.
Sorry, now I really do not understand.
If you get data as a website in a browser, you can use a mause and simply mark text needed and copy to the clipboard common for all Windows applications.
Gregor63
sorry, using a mouse instead of a mause it will be better :-)
Gregor63
OK well let me explain in more detail
I am displaying data in a formated way in a table, example:
|Email Address | More Data | More Data |
----------------------------------------------------
|Email Address | More Data | More Data |
----------------------------------------------------
|Email Address | More Data | More Data |
----------------------------------------------------
|Email Address | More Data | More Data |
----------------------------------------------------
|Email Address | More Data | More Data |
----------------------------------------------------
Now, if this is displayed in a browser you cant simply copy all the email addresses without copying everything else as well.
So i want to make a link/button the user can click that will copy the data i pull from the database to the clipboard... For example
Click Here To Copy All EMails Addresses To YouR ClipBoard
When the user clicks the link i use PHP to goto the Database and collect all the email addresses and then parse them so as to be delimited by a "," or whatever then store this list in a variable....
Now I have my variable but how do i get it to the Clipboard?
PHP cannot do that for sure. Maybe there might be some trick with JavaScript, but I doubt it.
I haven't seen something like that, but you can have a link that pops up all of the e-mail addresses seperated by a ,. try this
<a href="email.php">Click here to see all emails</a>
in email.php
<?php
$connection = mysql_connect("host", "user", "pass")
or die("Query Failed");
$db = mysql_select_db("database");
$query = "SELECT * FROM tablename";
$result = mysql_query($query);
while ($rows = mysql_fetch_row($result)) { ?>
<?php echo $rows["email"]; ?>,
<?php } ?>
That will open up a page with a list of email addresses like this
email@email.com, email@email.com, email@email.com etc..
They can copy and paste that easy..
I figured it out... 1 line of javascript. Thanks anyway!
cool
so what is this line?
this interests me as well....
Probably something along these lines...
http://java.sun.com/products/jdk/1.2/docs/api/java/awt/datatransfer/Clipboard.html
http://www.rgagnon.com/javadetails/java-0382.html
I don't think so...
Java is something very different from JavaScript
These links are about Java
Try to create "new" webpage basing on the page with e-mail addresses and other information, but print only the information about links.
In your "new" webpage divide all links on 2 field: name and e-mail address, e.g.
John Brown | mailto:jb@funnycompany.com
Mickey Mouse | mailto:mickey@disneyland.com
and so on.
If you copy such matched block to clipboard you will obtain what you want. Some editors, like Word will recognize the sequence mailto:.... and create blue, active links :-) in the document you pasted clipboard content.
Gregor63
Define a function (JavaScript):
function copytoclip(SomeText) {
window.clipboardData.setData("Text", SomeText);
}
<a href='javascript:copytoclip("This will be in my Clipboard shortly")'>
Make sure the users only use a recent version of IE, doesn't work on any other browser afaik. Haven't tried it though.