0

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

1 回答 1

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;
于 2012-08-03T02:24:15.373 回答