JoeD77
asked on
ZeroClipboard not working after php processes the page
I'm using php to dynamically create rows based on values from a database. At the end of each row I want to include functionality to copy the contents of that row to the clipboard.
I have working copy-to-clipboard code here:
however, when I process it via php and output the page like so:
a working ZeroClipboard element is ONLY included on the FIRST ROW. all subsequent rows below the first are just plain-text "Copy" without the underlying necessary element that ZeroClipboard creates.
Does ZeroClipboard work like this? Or is it limited to only statically created pages? Or am I just doing something wrong in my dynamic ZeroClipboard implementation?
Thank you!
I have working copy-to-clipboard code here:
<script language="JavaScript">
function cboard(text)
{
var clip = new ZeroClipboard.Client();
clip.setText(text);
clip.glue( 'd_clip_button' );
}
</script>
<script type="text/javascript" src="ZeroClipboard.js"></script>
<div id="d_clip_button" onMouseOver="cboard('party');" style="border:1px solid black; padding:20px;">Copy To Clipboard</div>
however, when I process it via php and output the page like so:
$result = mysql_query("SELECT * FROM `backup` ORDER BY `id` ".sort_order()." LIMIT ".($logspage*$_SESSION["page"])." , ".$logspage.";", $mysql);
if (!$result) die(mysql_error());
$html .= "Logs".$header.$javascript."
<form name='frm' method='POST' action='?action=selected' onsubmit='return checkform();'>
<table id='logstable' cellpadding='2' cellspacing='0' border='0'><tr id='row0'>
<td><a href='?action=logs&sort=0'>name/ ref</a></td>
<td><a href='?action=logs&sort=1'>date</a></td><td><a href='?action=logs&sort=2'>password</a></td>
<td><a href='?action=logs&sort=3'>website</a></td><td><a href='?action=logs&sort=4'>ip</a></td>
<td><input type='checkbox' name='check_all' onClick='checkAll();'></td></tr>";
$i = 0;
while ($row = mysql_fetch_array($result)) {
$html .= "<tr class='";
if ($i % 2 == 0) $html .= "row1"; else $html .= "row2";
$html .= "'><td>".$row["ref"]."</td>";
$html .= "<td>".$row["name"]."</td><td>".$row["pass"]."</td><td>".$row["ip"]."</td>";
$html .= "<td>".$row["date"]."</td>";
$html .= "<td><input type='checkbox' name='sel[]' value='".$row["id"]."'><div id=\"d_clip_button\" onMouseOver=\"cboard('".$row["website"]."');\"><b>Copy</b></div></td></tr>";
$i++;
}
a working ZeroClipboard element is ONLY included on the FIRST ROW. all subsequent rows below the first are just plain-text "Copy" without the underlying necessary element that ZeroClipboard creates.
Does ZeroClipboard work like this? Or is it limited to only statically created pages? Or am I just doing something wrong in my dynamic ZeroClipboard implementation?
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.