【发布时间】:2017-09-05 03:49:57
【问题描述】:
我想从 php 代码中调用一个 javascript 函数 myfunction()。代码如下:
<script>
function myfunction() {
var r = confirm("Are you sure ? ");
if (r == true) {
//delete file from database with id b_id
}
<?php header("Refresh:0"); ?>
}
</script>
我想从这个 php 代码中调用 js 函数。
<?php
while(//fetched database elements one by one)
{
//$b_id fetched from database.
echo "<button class='w3-display-topright pe-7s-close-circle w3-xxlarge w3-button' onclick="myfunction($b_id);"></button>
}
?>
【问题讨论】:
-
看this
-
有什么方法可以达到我的目的吗?帮帮我。
标签: javascript php