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
<scipt>
var d = new Date();
if (d.getHours() < 12)
document.getElementById("chao").innerHTML= "<b>Hôm nay cố gắng nhé</b>";
else
document.getElementById("chao").innerHTML= "<i>Chiều nay bạn thế nào?</i>";
</script>
2.
Phát biểu nào đúng về đoạn code sau:
Chọn ngày sinh:
<script>
n = 1;
while ( n <= 31) {
document.write("Ngày " + n + "");
n++;
}
</script>
3.
Đoạn code sau làm gì
<script>
var x = 0;
do {
a = prompt("Nhập giá trị biến a đi bồ");
while (isNaN(a)==true || a<0 || a>10 );
</script>
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
<script>
var qt = ["Nhân", "Lễ", "Nghĩa","Trí","Tín"];
for (var i = 0; i < qt.length; i++)
document.write( "<p>" + qt[i] + "</p>");
document.write("<hr>");
</script>
5.
Mời xem đoạn code javascript dưới đây
<script>
function dtb(toan, ly, hoa) {
var t = (toan + ly + hoa)/3;
return t;
}
var dtb = dtb(9, 3, 7);
</script>
<div id="diem">
<script>
document.write("ĐiểmTB = " + dtb.toFixed(2) );
</script>
</div>
6.
Đoạn code dưới đây làm gì
<h1 id="so"></h1>
<script>
dh = setInterval("hienso()", 2000);
function hienso(){
n = Math.round(Math.random()*31);
document.getElementById('so').innerText= n;
}
</script>
7.
Phát biểu nào sau đây đúng
<script>
setInterval("alert('Đời vui lắm em có biết không?')", 500)
</script>
8.
Code sau làm gì
<input value="Tuổi" onblur="this.className='x'" onfocus="this.className='d'">
<style>
.x { background:blue; color: white;}
.d { background:red; color: yellow;}
</style>
9.
Mô tả nào đúng cho code sau (chọn 2)
Số lượngSP:
<input type="number" onkeyup="tt(this.value)" ondblclick="this.style.color='red'"><br>
Đơn giá sp : <span id="gia">50000</span><br>
Thành tiền : <span id="thanhtien"></span><br>
<script>
function tt(soluong){
gia = document.getElementById("gia").innerText;
document.getElementById("tien").innerText=soluong*gia;
}
</script>
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++"
>