当用PHP编写的语句发挥作用时,如何制作警报框弹出窗口?
我现在要做的工作的JS代码是这样的:
$(".bAlert").click( function() {
jAlert('This is a custom alert box. Title and this text can be easily editted', 'Alert Dialog Sample');
});
将此代码用于按钮时此代码可以正常工作,但我希望它在此语句发挥作用时显示:
if ($operation == "divide") {
$answer = $number1 / $number2;
$operation = "÷";
} else {
$output = "CODE TO MAKE THIS WORK HAS TO GO HERE";
}
这是使用按钮的方式:
<input type="button" value="Usual alert" class="basicBtn mr10 ml10 bAlert" />
答案 0 :(得分:0)
把它放在else语句中
if ($operation == "divide"):
$answer = $number1 / $number2;
$operation = "÷";
else:
echo "<script>jAlert('This is a custom alert box. Title and this text can be easily editted', 'Alert Dialog Sample');</script>";
endif;