Trying to get this to work on both IE and Firefox.
I found this script by searching
[code]
<html>
<script>
function copy_clip(meintext){
if (window.clipboardData){
window.clipboardData.setData(“Text”, meintext);
}else if (window.netscape){
netscape.security.PrivilegeManager.enablePrivilege (‘UniversalXPConnect’);
var clip = Components.classes[‘@mozilla.org/widget/clipboard;1’].createInstance(Components.interfaces.nsIClipboard );
if (!clip) return;
var trans = Components.classes[‘@mozilla.org/widget/transferable;1’].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;
trans.addDataFlavor(‘text/unicode’);
var str = new Object();
var len = new Object();
var str = Components.classes[“@mozilla.org/supports-string;1”].createInstance(Components.interfaces.nsISupportsString);
var copytext=meintext;
str.data=copytext;
trans.setTransferData(“text/unicode”,str,copytext.length*2);
var clipid=Components.interfaces.nsIClipboard;
if (!clip) return false;
clip.setData(trans,null,clipid.kGlobalClipboard);
}
return false;
}
//–>
</script>
<body>
<form name=”testform”>
<textarea name=”testsquare”>
</textarea>
<br>
<input type=”button” onclick=”return copy_clip(document.forms[0].testsquare.value)” value=”Copy to Clipboard”>
</form>
</body>
</html>
Which works great. Now im trying to adapt this to what i want it to copy.
which is this,
[code]
Reason for requesting replacement:<?php echo $rfr;?><br>
Make/Model Number:<?php echo $mk; ?> , <?php echo $md; ?><br>
WDS: <?php echo $wd; ?><br>
Serial Number: <?php echo $sn; ?><br>
MAC Address: <?php echo $ma; ?><br>
IP Address: <?php echo $ip; ?><br>
Property ID: <?php echo $pp; ?><br>
Property Contact Name/Title:<?php echo $ct; ?><br>
Shipping Severity: <?php echo $sp; ?><br>
Ticket #: <?php echo $tt; ?><br>
Comments: <?php echo $cm; ?><br>
Now that is fed from a form. How would i go about adapting all this. I have tried just pasting this into the text area but that didnt work. I have tried adding a table and adding it in there but then the javascript errors out.
any ideas?
Thanks for all the help!!!!