Ok here is all the code I have so far concerning the onclick events:
Code:
<table id="currentjobs"><tr class="headings"><th class="first">Invoice Number</th><th>Name</th><th>Start</th><th>Finish</th><th>Job Description</th><th>Boat Type</th><th id="last"></th></tr>
while($row = mysql_fetch_array($query)) // Go through all records in the database, echo the following code for each record found
{
<tr class="data" onclick="document.location='" . $_SERVER['PHP_SELF'] . "?id=" . $row['id'] . "'" title="Click to view job"><td>" . "M" . $row['id'] . "</td><td>" . $row['name'] . "</td><td>". convertDate($row['start_date']) . "</td><td>" . convertDate($row['finish_date']) . "</td>";
<td>" . $row['description'] . "</td><td>" . $row['boat_type'] . "</td><td class="last"><a class="remove" title="Delete Job" onclick="RemoveJob("; echo $row['id']; echo ")"></a></td></tr>";
}
echo "</table>";
There's some PHP mixed in with it all but shouldn't affect the function.
RemoveJob function:
Code:
function RemoveJob(id)
{
var e=window.event||arguments.callee.caller.arguments[0];
e.cancelBubble=true;
if (e.stopPropagation) e.stopPropagation();
var response = confirm('Are you sure you want to delete the job?');
if (response == true)
{
new Ajax.Request("removeapp.php",
{
method: 'post',
postBody: 'id=' + id + '&type=job',
onComplete: refreshTable
});
}
return false;
}
Hope this helps.
Bookmarks