PDA

View Full Version : Firefox - Copy Text Box Problem


wwfc_barmy_army
02-04-2006, 10:09 AM
Hello.

I am currently using this code on my website so that the user can copy the info in the textbox:


<input type="submit" name="Submit" value="Copy Code" onClick="CopySelection(<?php echo "Pro".$qry['ProductID'] ?>)">

I've had a further look and i believe this is to do with it (found in the same file):


<script language="JavaScript">

function CopySelection(Control)

{

// alert(ControlID.value);

Control.focus();



Control.select();



CopiedTxt = document.selection.createRange();



CopiedTxt.execCommand("Copy");

}

</script>

I have found that this doesn't work in firefox but it does in IE. How can i change this code so it works in firefox too?

Thanks in advance.

Regards.

P Plant.

GJay
02-04-2006, 12:40 PM
Mozilla's security-prefs stop the clipboard functions from working out of the box, if you want to change them locally you can do, or you could take a look at 'signed scripts', not exactly sure how they work though:

http://www.mozilla.org/editor/midasdemo/securityprefs.htm
http://www.mozilla.org/projects/security/components/signed-scripts.htmll