Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raitis Ralfs
www_js
Commits
0f6deb14
Commit
0f6deb14
authored
Mar 07, 2018
by
Raitis Ralfs
Browse files
Add event listener
parent
0c8d01e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
index.html
index.html
+5
-3
script.js
script.js
+13
-5
No files found.
index.html
View file @
0f6deb14
...
@@ -25,9 +25,11 @@
...
@@ -25,9 +25,11 @@
<hr>
<hr>
<h2>
Otrais Uzdevums
</h2>
<h2>
Otrais Uzdevums
</h2>
<p
id=
"otraisUzdevums"
>
Hipotenūzas garums, kur a = 189, b = 256 ir
</p>
<input
type=
"number"
id=
"a"
placeholder=
"Hipotenūzas A garums"
>
<button
onclick=
"otraisUzdevums()"
>
Spied lai iegūtu hipotenūzas garumu
</button>
<input
type=
"number"
id=
"b"
placeholder=
"Hipotenūzas B garums"
>
<button
id=
"otraisUzdevums"
>
Spied lai iegūtu hipotenūzas garumu
</button>
<p>
Hipotenūzas garums ir
</p>
<p
id=
"otraisUzdevumsParagraph"
></p>
<hr>
<hr>
<h2>
Trešais Uzdevums
</h2>
<h2>
Trešais Uzdevums
</h2>
...
...
script.js
View file @
0f6deb14
...
@@ -27,14 +27,22 @@ function pirmaisUzdevums() {
...
@@ -27,14 +27,22 @@ function pirmaisUzdevums() {
dateParagraph
.
innerText
+=
"
plkst.
"
+
datums
.
getHours
()
+
"
:
"
+
datums
.
getMinutes
();
dateParagraph
.
innerText
+=
"
plkst.
"
+
datums
.
getHours
()
+
"
:
"
+
datums
.
getMinutes
();
}
}
/*
function otraisUzdevums() {
function otraisUzdevums() {
let hypotParagraph = document.getElementById("otraisUzdevums");
let hypotParagraph = document.getElementById("otraisUzdevums");
let
a
=
189
;
let a =
document.getElementById("a").value
;
let
b
=
256
;
let b =
document.getElementById("b").value
;
hypotParagraph
.
innerText
+
=
"
"
+
Math
.
hypot
(
a
,
b
).
toPrecision
(
5
);
hypotParagraph.innerText = " " + Math.hypot(a, b).toPrecision(5);
}
}
*/
document
.
getElementById
(
"
otraisUzdevums
"
).
addEventListener
(
"
click
"
,
function
(
e
){
let
hypotParagraph
=
document
.
getElementById
(
"
otraisUzdevumsParagraph
"
);
let
a
=
document
.
getElementById
(
"
a
"
).
value
;
let
b
=
document
.
getElementById
(
"
b
"
).
value
;
hypotParagraph
.
innerText
=
Math
.
hypot
(
a
,
b
).
toPrecision
(
5
);
});
function
tresaisUzdevums
()
{
function
tresaisUzdevums
()
{
let
canvasElement
=
document
.
getElementById
(
"
tresaisUzdevums
"
);
let
canvasElement
=
document
.
getElementById
(
"
tresaisUzdevums
"
);
...
@@ -51,4 +59,4 @@ function tresaisUzdevums() {
...
@@ -51,4 +59,4 @@ function tresaisUzdevums() {
$
(
'
.ceturtaisUzdevums
'
).
click
(
function
(){
$
(
'
.ceturtaisUzdevums
'
).
click
(
function
(){
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
800
);
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
800
);
return
false
;
return
false
;
});
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment