bluewalrus
06-14-2010, 05:51 PM
I have this code currently which works but I dont actually need the textarea any more so how can I set the "clip" to be the value?
<textarea id="fe_text" onChange="clip.setText(this.value)"><?php echo conversion($input);?></textarea>
<div id="d_clip_container">
<div id="d_clip_button" class="my_clip_button">Copy It.</div>
</div>
Full Code:
<script language="JavaScript">
var clip = null;
function $(id) { return document.getElementById(id); }
function init() {
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.addEventListener('load', function (client) {
debugstr("Flash movie loaded and ready.");
});
clip.addEventListener('mouseOver', function (client) {
// update the text on mouse over
clip.setText( $('fe_text').value );
});
clip.addEventListener('complete', function (client, text) {
debugstr("Copied text to clipboard: " + text );
});
clip.glue( 'd_clip_button', 'd_clip_container' );
}
function debugstr(msg) {
var p = document.createElement('p');
p.innerHTML = msg;
$('d_debug').appendChild(p);
}
</script>
I think it'd look something like...
<script type="text/javascript">
var content_is = "<?php echo conversion($input);?>";
clip.setText(content_is.value);
</script>
Thanks for any ideas. If this isn't clear please let me know and I will try to be more specific.
<textarea id="fe_text" onChange="clip.setText(this.value)"><?php echo conversion($input);?></textarea>
<div id="d_clip_container">
<div id="d_clip_button" class="my_clip_button">Copy It.</div>
</div>
Full Code:
<script language="JavaScript">
var clip = null;
function $(id) { return document.getElementById(id); }
function init() {
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.addEventListener('load', function (client) {
debugstr("Flash movie loaded and ready.");
});
clip.addEventListener('mouseOver', function (client) {
// update the text on mouse over
clip.setText( $('fe_text').value );
});
clip.addEventListener('complete', function (client, text) {
debugstr("Copied text to clipboard: " + text );
});
clip.glue( 'd_clip_button', 'd_clip_container' );
}
function debugstr(msg) {
var p = document.createElement('p');
p.innerHTML = msg;
$('d_debug').appendChild(p);
}
</script>
I think it'd look something like...
<script type="text/javascript">
var content_is = "<?php echo conversion($input);?>";
clip.setText(content_is.value);
</script>
Thanks for any ideas. If this isn't clear please let me know and I will try to be more specific.