I have a table in one of the column in a row i use a hyperlink with "Edit" where i call a javascript function (which launches a popup-window)
This is one of my table row
echo "<tr>";
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['firstname'] . '</td>';
echo '<td>' . $row['lastname'] . '</td>';
echo '<td>' .
'<a href=\"javascript:popup_window_show('#sample', { pos : 'window-center', width : '270px' });'>Edit</a>
. '</td>';
echo '<td><a href=\"javascript:popup_window_show('#sample', { pos : 'window-center', width : '270px' });'>Edit</a></td>';
I have used two methods for Edit hyperlink, the first has no prob with code but doesn't shows the 'Edit' in the cell.. and the second has some errors with syntax
Below is my Js function in popup-window.js
function popup_window_show(/*selector,*/ args)
{
var pos = args.pos ? args.pos : null;
if (pos == 'window-center' )
{ x += $(document).scrollLeft()+($(window).width()-obj.width())*1/2; y += $(document).scrollTop()+($(window).height()-obj.height())*1/2; }
}
And also how do i pass row data to the js function (say firstname)
") in single quotes', you don't have toescapethem like this\".