Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
P3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebTek 42
P3
Commits
c07491e5
Commit
c07491e5
authored
3 years ago
by
Fredrik Baksaas
Browse files
Options
Downloads
Patches
Plain Diff
Endra handlekurv.js til å fungere med meny
parent
c87a6b52
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/handlekurv.js
+11
-11
11 additions, 11 deletions
js/handlekurv.js
with
11 additions
and
11 deletions
js/handlekurv.js
+
11
−
11
View file @
c07491e5
...
@@ -28,7 +28,7 @@ const handlekurv = JSON.parse(localStorage.getItem("handlekurv"));
...
@@ -28,7 +28,7 @@ const handlekurv = JSON.parse(localStorage.getItem("handlekurv"));
for
(
let
vare
of
varer
){
for
(
let
vare
of
varer
){
let
index
=
vare
.
index
;
let
index
=
vare
.
index
;
let
submit
=
document
.
getElementById
(
"
submitIndex
"
+
index
);
let
submit
=
document
.
getElementById
(
"
submitIndex
"
+
index
);
let
pointer
=
vare
;
let
pointer
=
vare
.
navn
;
if
(
submit
){
if
(
submit
){
submit
.
addEventListener
(
"
click
"
,
function
(){
leggTilHandlekurv
(
pointer
)});
submit
.
addEventListener
(
"
click
"
,
function
(){
leggTilHandlekurv
(
pointer
)});
...
@@ -36,28 +36,28 @@ for(let vare of varer){
...
@@ -36,28 +36,28 @@ for(let vare of varer){
}
}
function
leggTilHandlekurv
(
vare
){
function
leggTilHandlekurv
(
vare
){
let
index
=
vare
.
index
;
let
select
=
document
.
getElementById
(
"
selectIndex
"
+
index
)
let
antall
=
select
.
value
;
let
navn
=
null
;
let
navn
=
null
;
for
(
item
of
handlekurv
){
for
(
item
of
handlekurv
){
if
(
item
.
navn
==
vare
.
navn
){
if
(
item
.
navn
==
vare
){
navn
=
item
;
navn
=
item
;
navn
.
antall
++
;
}
}
}
}
if
(
!
navn
){
if
(
!
navn
){
handlekurv
.
push
(
vare
);
for
(
item
of
vare
r
){
navn
=
vare
;
if
(
item
.
navn
=
=
vare
){
navn
.
antall
++
;
navn
=
item
;
antall
--
;
}
}
}
for
(
let
i
=
0
;
i
<
antall
;
i
++
){
handlekurv
.
push
(
navn
);
navn
.
antall
++
;
navn
.
antall
++
;
}
}
sorterListe
();
sorterListe
();
console
.
log
(
handlekurv
);
console
.
log
(
handlekurv
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment