3-amaliy ish Mavzu: jquery selektorlar,hodisalar. Jquery ui


Download 225.99 Kb.
bet8/8
Sana18.06.2023
Hajmi225.99 Kb.
#1583731
1   2   3   4   5   6   7   8
Bog'liq
3-amaliy

html>
<head>
<title>jQuerytitle>
<style>
button {
background-color: orange;
color: white;
border: 2px outset orange;
}
input, button {
outline: none;
}
#error {
color: red;
}
style>
<script sre="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous">script>
<script>
let onReady = function () {
jQuery('#error').hide();
jQuery('button').on('mousedown', function() {
jQuery(this).css('border-style', 'inset');
});
jQuery('button').on('mouseup', function() {
jQuery(this).css('border-style', 'outset');
let num1 = jQuery('#num1').val();
let num2 = jQuery('#num2').val();
num1 = Number(num1);
num2 = Number(num2);
if(isNaN(num1) || isNaN(num2)) {
jQuery('#error').fadeIn();
jQuery('#result').html(0);
} else {
jQuery('#error').fadeOut();
jQuery('#result').html(num1 + num2);
}
});
}
jQuery(onReady);
script>
head>
<body>
<input id="num1" type="text" size"5" />
<span>+span>
<input id="num2" type="text" size"5" />
<button type="button">=button>
<span id="result">0span>
<div id="error">Iltimos, raqam kiritingdiv>
body>
html>

Tayyorladi:_______________________________________Abdimo’minov.A
Download 225.99 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling