在php-if上调用一个修改过的alert函数

call a modified alert function on php if

本文关键字:修改 一个 函数 alert php-if 调用      更新时间:2023-09-26

我正试图调用一个java脚本函数,当用户单击锚链接时,该函数会显示一个修改后的警告框作为警告

在这种情况下,我使用$_REQUEST['id']作为参考来检查我的链接是否已经被点击

PHP

if(isset($_REQUEST['id'])) {
// how can I call my function which will display my modified alert box here? 
// is it possible?
}

Javascript:

<script>   
function myFunction() {
      $("#dialog-confirm").dialog({
      resizable: false,
      height: 300,
      width: 700,
      modal: true,
      buttons: {
          "Upload": function() {
          document.forms["form1"].submit();

          $(this).dialog("close");
          },
          Cancel: function() {
          window.location.href = "uploadCSV.php";
          $(this).dialog("close");
          }
      }
      });
  }
 </script>

锚链接:

echo '<a name="' . $row['Id'] . '"><tr class="even pointer"><td class="a-center ">

您可以用这种方式编写代码。

<?php
if(isset($_REQUEST['id'])) {
// how can I call my function which will display my modified alert box here? 
// is it possible?
?>
<script> myFunction(); </script>
<?php
}
?>

谢谢Amit