簡體   English   中英

警報(模態窗口)框聲明

[英]Alert(Modal Window) Box On Statement

當用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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM