声明(模态窗口)框上的声明

时间:2012-08-03 02:13:08

标签: 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") { 
    $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" />

1 个答案:

答案 0 :(得分:0)

把它放在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;