<html>
<head>
</head>
<body>
<div id = "paragraph">
<p id ="para1" class="para">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi vero doloremque perferendis expedita optio nobis ex ipsa tempore reprehenderit dolor tenetur quasi minima atque maiores reiciendis labore repellendus, alias blanditiis?</p>
<p id ="para2" class="para">reprehenderit, sapiente possimus iste nostrum architecto reiciendis vitae quam aspernatur, a, saepe recusandae minima et sint nesciunt.</p>
<p id ="para3" class="para">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas assumenda vero magni labore reprehenderit, sapiente possimus iste nostrum architecto reiciendis vitae quam aspernatur, a, saepe recusandae minima et sint nesciunt.</p>
</div>
</body>
</html>
/*Downloaded from https://www.codeseek.co/trieutruong/a-pen-by-trieu-truong-GNEbRX */
/*Downloaded from https://www.codeseek.co/trieutruong/a-pen-by-trieu-truong-GNEbRX */
//function changeFontSize(x): Thay đổi kích thước font chữ của cả 3 đoạn văn thành x pixels.
function change_font_size(x){
var a = document.getElementsByClassName('para');
for(var i = 0; i<a.length; i++){
a[i].style.fontSize = x +'px';
}
}
change_font_size(20);
/*function increaseFontSize(paragraph): Tăng kích thước font chữ của đoạn văn mong muốn (paragraph) lên 1 pixel so với kích thước hiện tại, kích thước tăng lên không được vượt quá 30 pixels (Sử dụng sau khi gọi hàm changeFontSize()). */
change_font_size(20);
function increaseFontSize(y){
var a = parseInt(document.getElementById(y).style.fontSize);
if(a<30){
document.getElementById(y).style.fontSize = a + 1 +'px';
}else{
alert ("abc");
}
}
increaseFontSize('para3');
/*function decreaseFontSize(paragraph): Giảm kích thước font chữ của đoạn văn mong muốn (paragraph) xuống 1 pixels so với kích thước hiện tại, kích thước giảm xuống không vượt quá 10 pixels (Sử dụng sau khi gọi hàm changeFontSize()). */
function decreaseFontSize(z){
var b = parseInt(document.getElementById(z).style.fontSize);
if(b>10){
document.getElementById(z).style.fontSize = b-1 +'px';
} else {
alert ("bcd");
}
}
decreaseFontSize('para3');
/* function changeColor(): Đổi màu chữ của 3 đoạn văn theo thứ tự xanh, vàng, đỏ.*/
function changeColor(){
document.getElementById('para1').style.color = 'blue';
document.getElementById('para2').style.color = 'yellow'; document.getElementById('para3').style.color = 'red';
}
changeColor();
/*function changeBgColor(color): Thay đổi màu nền của trang thành màu color. */
function changeBgColor(){
document.getElementById('paragraph').style.background = 'green';
}
changeBgColor();
/*function copyContent(paragraph1, paragraph2): Thay đổi nội dung của đoạn văn paragraph1 thành giống nội dung của đoạn văn paragraph2.*/
function copyContent(paragraph1, paragraph2){
document.getElementById("para1").innerHTML
= document.getElementById('para2').innerHTML;
}
copyContent('para1','para2');