Can this be done guy?

Below I have my php

PHP Code:
if($_FILES['logo']['name']=="") {
copy("$src","$fname2");
$q24=mysql_query("update category set category_Name='$name', category_metaTitle='$meta', category_Image='$fname2', category_Description='$desc1', category_Active='$active' where cat_Id=$sr") or die (mysql_error());
$flag=1;
$conf="Data Updated Successfully 1";
} else {
copy("$src","imgdata/category/$fname");
$q24=mysql_query("update category set category_Name='$name', category_metaTitle='$meta', category_Image='imgdata/category/$fname', category_Description='$desc1' where cat_Id=$sr") or die (mysql_error());
$flag=1;
$conf="Data Updated Successfully 2";

At the bottom of each I have a successful call, ($conf="Data Updated Successfully 1") but what I would like to do is call a javascript function instead of the script being called using a button as below.

Code:
<input type="button" onclick="javascript:cover();" value="fade now" />
Can this be done