Php 语句上的警报(模式窗口)框
当用PHP编写的语句发挥作用时,我将如何制作一个弹出的警报框 我现在要做的JS代码是:Php 语句上的警报(模式窗口)框,php,javascript,html,Php,Javascript,Html,当用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
$(".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" />
只要把它放在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;
if($operation==“divide”):
$answer=$number1/$number2;
$operation=“÷;”;
其他:
echo“jAlert('这是一个自定义警报框。标题和此文本可以轻松编辑','警报对话框示例');”;
endif;
除非php已经位于某些脚本标记中,否则您可能也需要将其包装在脚本标记中,对吗?我认为不需要使用。click()
处理程序,至少我的印象是OP只是想直接调用jAlert()
。