Hello, I'm adding functionality to allow a user to copy data on a page to the clipboard using JS. This can be done simply with: window.clipboardData.setData('Text','String to copy to clipboard'); The string from PHP needs to contain line breaks when copied into the clipboard. This works when I use \n, e.g. 'This string\nspans multiple\nlines' but how do I escape this string when outputting it from PHP? addslashes() seems the obvious choice, but as it escapes backslashes, the \n chars end up in the clipboard! Using hard new lines in the argument passed to the JS function doesn't work as this causes JS errors: DOESN'T WORK: <script type="text/javascript"> var sCopy = 'String to copy to clipboard'; </script> <input type="button" value="COPY" onclick="window.clipboardData.setData('Text',sCopy);" /> Any ideas? Thanks, Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php