Function dialog box confirm ()

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>函数对话框confirm()</title>
    <!-- 
        if confirm ( "message 1") {a} else {code block codes b};
        Generate a dialog box displays information 1 and "OK" / "Cancel" button
        Click OK to return the user to confirm () function is true; click Cancel to return confirm () function false
        When the confirm () is true, a block of code
        When the confirm () is false, execute code b
     -> 
</ head > 
< body > 
    < Script > 
        var x = " ha " 
        // page generation dialog box displaying the information of the variable x, and OK / Cancel button 
        IF (Confirm (x)) {
            document.write ( " you laugh " ); // Press OK to execute the code 
        } the else {
            document.write ( " you did not laugh " ); // Press cancel executing the code 
        }
     </ Script > 
</ body > 
</ HTML >

Guess you like

Origin www.cnblogs.com/vinson-blog/p/12040310.html