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
407d3652
Commit
407d3652
authored
3 years ago
by
Sondre Sommerset Nordvik
Browse files
Options
Downloads
Patches
Plain Diff
laget js funksjon for min_side
parent
244d29e7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/minSide.js
+74
-0
74 additions, 0 deletions
js/minSide.js
min_side.html
+7
-5
7 additions, 5 deletions
min_side.html
with
81 additions
and
5 deletions
js/minSide.js
0 → 100644
+
74
−
0
View file @
407d3652
// Henter elementene som skal gjøre noe med
const
OBknapp
=
document
.
getElementById
(
"
OBknapp
"
);
const
loggInn
=
document
.
getElementById
(
"
loggInn
"
);
const
brukernavn
=
document
.
getElementById
(
"
brukernavn
"
);
const
passord
=
document
.
getElementById
(
"
passord
"
);
// Funkjson som gir brukeren beskjed om brukernavn eller passord mangler eller begge. Brukers både ved logg inn og opprett bruker
function
opprettetBruker
()
{
if
(
brukernavn
.
value
==
""
&&
passord
.
value
==
""
)
{
alert
(
"
brukernavn og passord mangler
"
);
}
else
if
(
brukernavn
.
value
==
""
)
{
alert
(
"
Vennlist skriv inn et brukernavn
"
);
}
else
if
(
passord
.
value
==
""
)
{
alert
(
"
Vennligst skriv inn et passord
"
);
}
else
{
alert
(
"
Bruker Logget inn/opprettet
"
);
}
}
// Bruker eventLister for å koble funksjonen opp mot "Logg inn" og "Opprett bruker"
OBknapp
.
addEventListener
(
"
click
"
,
opprettetBruker
);
loggInn
.
addEventListener
(
"
click
"
,
opprettetBruker
);
// // // Part 2-5 Todo functionalities
// // // Declaring elements which will be altered
// // const inputField = document.getElementById("inputField");
// // const form = document.getElementById('todoForm');
// // const todoList = document.getElementById("todoList");
// // const completed = document.getElementById("completed");
// // // Declaring tasks as an empty list
// // const tasks = [];
// // // The main function
// // function addTask(event) {
// // // preventDefault() => The page does not reload itself
// // event.preventDefault();
// // // Using if statement to check if user has given any input
// // if (inputField.value != "") {
// // // Adding a task object with the input, making sure it is unchecked and marking the date
// // const task = { description: inputField.value, checked: false, dateTime: Date() }; //description
// // // Using unshift instead of push to add the newest task object ontop of the tasks list, and console logging the result
// // tasks.unshift(task);
// // console.log(tasks);
// // alterList();
// // }
// // else {
// // alert("A task has to be filled in");
// // }
// // // clearing the input field after an input is submitted
// // inputField.value = "";
// // }
// // // using eventListener to connect the function with the todo form on submit
// // form.addEventListener("submit", addTask);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
min_side.html
+
7
−
5
View file @
407d3652
...
...
@@ -20,24 +20,26 @@
<form>
<p>
Brukernavn:
</p>
<label
id=
"username"
>
<input
type=
"text"
name=
"username"
placeholder=
"Brukernavn"
required
>
<input
type=
"text"
id=
"brukernavn"
name=
"username"
placeholder=
"Brukernavn"
required
>
</label>
<br
/>
<p>
Passord:
</p>
<label
id=
"password"
>
<input
type=
"password"
name=
"password"
placeholder=
"Passord"
required
>
<input
type=
"password"
id=
"passord"
name=
"password"
placeholder=
"Passord"
required
>
</label>
<br
/>
<input
type=
"submit"
value=
"Logg inn"
>
<input
type=
"submit"
value=
"Logg inn"
id=
"loggInn"
>
<br
/>
</form>
<p>
Har du ikke bruker, opprett her:
</p>
<button
type=
"button"
>
Opprett bruker
</button>
<button
id=
"OBknapp"
type=
"button"
>
Opprett bruker
</button>
</div>
</main>
<script
src=
"js/minSide.js"
></script>
<script
src=
"js/footer.js"
></script>
<script
src=
"js/navbar.js"
></script>
<script
src=
"js/handlekurvVindu.js"
></script>
...
...
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