Trắc nghiệm Javascript số 3

    1. 
    Đoạn code sau được viết trong trang web của bạn. Chuyện gì xảy ra nếu user vào xem lúc 5 giờ chiều


    var d = new Date();
    if (d.getHours() < 12)
    document.getElementById("chao").innerHTML= "Hôm nay cố gắng nhé";
    else
    document.getElementById("chao").innerHTML= "Chiều nay bạn thế nào?";

    2. 
    Phát biểu nào đúng về đoạn code sau:

    Chọn ngày sinh:

    n = 1;
    while ( n <= 31) {
    document.write("Ngày " + n + "");
    n++;
    }

    3. 
    Đoạn code sau làm gì


    var x = 0;
    do {
    a = prompt("Nhập giá trị biến a đi bồ"); 
    while (isNaN(a)==true || a10 );

    4. 
    Mời xem code và chọn phát biểu đúng

    CÁC ĐỨC TÍNH CAO QUÝ CỦA CON NGƯỜI


    var qt = ["Nhân", "Lễ", "Nghĩa","Trí","Tín"];
    for (var i = 0; i < qt.length; i++)
    document.write( "

    " + qt[i] + "

    ");
    document.write("
    ");

    5. 
    Mời xem đoạn code javascript dưới đây

     
    function dtb(toan, ly, hoa) {
    var t = (toan + ly + hoa)/3;
    return t;
    }
    var dtb = dtb(9, 3, 7);



    document.write("ĐiểmTB = " + dtb.toFixed(2) );

    6. 
    Đoạn code dưới đây làm gì



    dh = setInterval("hienso()", 2000);    
    function hienso(){        
       n = Math.round(Math.random()*31);
       document.getElementById('so').innerText= n;        
    }

    7. 
    Phát biểu nào sau đây đúng


    setInterval("alert('Đời vui lắm em có biết không?')", 500)

    8. 
    Code sau làm gì



    .x { background:blue; color: white;}
    .d { background:red; color: yellow;}

    9. 
    Mô tả nào đúng cho code sau (chọn 2)

    Số lượngSP: 


    Đơn giá sp : 50000

    Thành tiền :


    function tt(soluong){
       gia = document.getElementById("gia").innerText;
       document.getElementById("tien").innerText=soluong*gia;
    }

    10. 
    Mời xem code dưới và chọn 2 phát biểu đúng

    <input type="number" 
      onfocus="this.style.backgroundColor='red'" 
      onblur="this.style.backgroundColor='white'" 
      onmousemove="this.value++"
    >