Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 语句上的警报(模式窗口)框_Php_Javascript_Html - Fatal编程技术网

Php 语句上的警报(模式窗口)框

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

当用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" />

只要把它放在else语句中就行了

if ($operation == "divide"):
    $answer = $number1 / $number2;
    $operation = "&#247;";
 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()