我需要show_alert()
在 PHP 代码中引入 JavaScript 警报功能。如何做到这一点?
script type="text/javascript">
function show_alert() {
var msg = "No solution found.";
alert(msg);
}
</script>
<?php
//...
$outputs = -1;
if ($outputs == -1) {
echo '<script type="text/javascript"> show_alert(); </script>';
} else {
?>
<table width="100%">
<tr>
<td width="100%">
<div class="scrollbar" id="chart">
<img src="ganttchart.php">
</div>
</td>
</tr>
</table>
<?php
}
?>