document.body.style.background = 'red'; // make the background red
setTimeout(() => document.body.style.background = '', 3000); // return back
const element = document.getElementById('myElement');
console.log(element.clientWidth); // Elementning ko'rinadigan kengligi
console.log(element.clientHeight); // Elementning ko'rinadigan balandligi
coding with ☕️
const element = document.getElementById('myElement'); console.log(element.clientWidth); // Elementning ko'rinadigan kengligi console.log(element.clientHeight); // Elementning ko'rinadigan balandligi
elementning ko'rinadigan qismining kengligi 1800px va balandligi 36pxForwarded from coding with ☕️
let hour = 12;
let minute = 30;
if (hour == 12 && minute == 30) {
alert( 'The time is 12:30' );
}
Forwarded from coding with ☕️
coding with ☕️
let hour = 12; let minute = 30; if (hour == 12 && minute == 30) { alert( 'The time is 12:30' ); }
Logical Opertors
window.pageXOffset is an alias of window.scrollX.
window.pageYOffset is an alias of window.scrollY.
click – when the mouse clicks on an element (touchscreen devices generate it on a tap).
contextmenu – when the mouse right-clicks on an element.
mouseover / mouseout – when the mouse cursor comes over / leaves an element.
mousedown / mouseup – when the mouse button is pressed / released over an element.
mousemove – when the mouse is moved.
<input type="button" id="button" value="Button">
<script>
button.onclick = function() {
alert('Click!');
};
</script>
<input id="elem" type="button" value="Click me"/>
<script>
function handler1() {
alert('Thanks!');
};
function handler2() {
alert('Thanks again!');
}
elem.onclick = () => alert("Hello");
elem.addEventListener("click", handler1); // Thanks!
elem.addEventListener("click", handler2); // Thanks again!
</script>