Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
<head>
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<title>Aktivitets Appen</title>
</head>
<body>
	<!-- HEADING -->
	<h1>Välj Aktivitet</h1>
	<button onclick="buttonAdmin()" id = "adminButton"/>ADMIN</button>

	<!-- Knappar -->
	<div class='buttonContainer'>
	  <button onclick = "buttonClicked('styrketräning')" id = "button1" value="">StyrkeTräning</button>
	  <button onclick = "buttonClicked('groupTräning')" id = "button2">GruppTräning</button>
	  <button onclick = "buttonClicked('kickBoxing')" id = "button3">KickBoxing</button>
	</div>

	<!-- Anvädaren har valt -->
	<div id="showChoice"></div>

    <!-- Contact Form -->

	<div id="formContainer"> 
 	 <form id = "myForm" onsubmit="return submitClicked()";>
 	 <fieldset>
		<p><label for = "Förnamn">Förnamn:</label><input type="text" name="firstname" id = "firstName"><span id="wrongfname" class="error"></p>
		<p><label for = "Efternamm">Efternamm:</label><input type="text" name="lastname" id = "lastName"><span id="wronglname" class="error"></p> 
		<p><label for = "Mobil.nr">Mobil.nr:</label><input type="number" name="mobil" id = "mobil"><span id="wrongmobil" class="error"></p>
		<p><label for = "Mejladress">Mejladress:</label><input type="text" name="mejl" id = "mejl"><span id="wrongmail" class="error"></p>
		<p><label><u>Gender:</u> <br><input type="radio" id = 'radioButton1' name="gender" value="Man"> Man <br>
  		<input type="radio"  id = 'radioButton2' name="gender" value="Kvinna" > Kvinna<br></label></p>
  		<textarea id = "textArea" name ="textarea"></textarea>
		<p><input onclick="submitClicked();" id = "submitButton" type="button" name="submitbutton" value="Submit" /> </p>
	  </fieldset>
	</form>
	</div>
    <p id = 'contactDetails'> </p>
	<h3 id = 'showPersonDetails'> </h3>
	<ul id="adminUl"></ul>

<script src="js/script.js"></script>
</body>
</html>
              
            
!

CSS

              
                body{
	background:url("https://i2.wp.com/livewallpaperhd.com/wp-content/uploads/2017/05/Plain-White-Background-Wallpaper-Hd.jpg?ssl\u003d1");
	background-repeat: no-repeat;
	background-size: 100%;
}
h1{
	font-family:sans-serif;
	font-size:50px;
	text-align:center;
}
.buttonContainer{
	margin:auto;
}
#button1{
	display: inline-flex;
  	margin: 0 10px 0 0;
  	padding: 15px 45px;
  	font-size: 48px;
  	font-family: "Bitter",serif;
  	line-height: 1.8;
  	vertical-align: bottom;
  	-webkit-appearance: none;
  	-moz-appearance: none;
  	 appearance: none;
  	-webkit-box-shadow: none;
  	-moz-box-shadow: none;
     box-shadow: none;
  	-webkit-border-radius: 0;
  	-moz-border-radius: 0;
  	 border-radius: 0;
}
#button2{
	display: inline-flex;
  	margin: 0 10px 0 0;
  	padding: 15px 45px;
  	font-size: 48px;
  	font-family: "Bitter",serif;
  	line-height: 1.8;
  	vertical-align: bottom;

  	
}
#button3{
	display: inline-flex;
  	margin: 0 10px 0 0;
  	padding: 15px 45px;
  	font-size: 48px;
  	font-family: "Bitter",serif;
  	line-height: 1.8;
  	vertical-align: bottom;

}
#showChoice {
	border:solid;
	height:auto;
	width:auto;
	text-align: center;
}
fieldset {
    min-width: 100px;
    display: inline-block;
}

fieldset input{
    float: right;
}

p {
    margin-bottom: 2px;
}
#formContainer{
	display:none;
	margin-left:40%;
	}
#submitButton{
	width: 100%;
  	height: 40px;
  	border: 1px solid black;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  	background-color:green;
}
#contactDetails {
	width:100%;
	justify-content:center;
	border:solid;
	float:left;
	text-align:center;
	text-orientation:sideways;
	display:none;
}
#showPerson{
	border:solid;
	height:150px;
	width:150px;
	text-align: center;
	text-overflow:none;
}



#button1:hover, #button2:hover, #button3:hover {
	 color: green;
  	 text-decoration: underline overline;
}

@media only screen and (min-width: 768px max-width:1024px) {
    body {

    	background:url("https://i2.wp.com/livewallpaperhd.com/wp-content/uploads/2017/05/Plain-White-Background-Wallpaper-Hd.jpg?ssl\u003d1" background-size:100%);
        background-color: lightblue;
    }
    .buttonContainer {
    	float:left;
    	margin:auto;
    	padding-left:0%;
    }
}

              
            
!

JS

              
                 // skapar en lista för att pusha in valet

  var chosenContainer = [];

  // sparar id i variablar för lättare access

  var showChoice = document.getElementById('showChoice');
  var formContainer = document.getElementById('formContainer');

// Steg 1 -  en funktion för att spara användarens val och visa det i skärmen
 

    function buttonClicked(x) {
  if (x === 'strength'){
    chosenContainer.push(x);
    showChoice.innerHTML = "Du har valt" + " " + "<b>" + chosenContainer[0] + "</b>";     
  }   else if (x === 'group'){
      chosenContainer.push(x);
    showChoice.innerHTML = "Du har valt" + " " + "<b>" + chosenContainer[0] + "</b>";
  }   else{
    chosenContainer.push(x);
    showChoice.innerHTML = "Du har valt" + " " + "<b>" + chosenContainer[0] + "</b>";
  }
    formContainer.style.display = "block";
  }
// Steg 2 - en funktion för att spara användarens info och pusha i an array
var personArray = []; 

    function submitClicked(){
    // info om personen
    var firstName = document.getElementById('firstName').value;
    var lastName = document.getElementById('lastName').value;
    var mobil = document.getElementById('mobil').value;
    var mejl = document.getElementById('mejl').value;
    var radioButton = document.querySelector('input[name="gender"]:checked').value;
    var textArea = document.getElementById('textArea').value;
    var mejlReg = /^[a-zA-Z]+([_\.-]?[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([\.-]?[a-zA-Z0-9]+)*(\.[a-zA-Z]{2,4})+$/;

      //  validateForm();

      var storedPerson = {
      fornamn: firstName +"<br>", 
      Efternamn: lastName+ "<br>",
      mejl: mejl+ "<br>",
      mobil: mobil+ "<br>",
      kommentar: textArea+ "<br>",
      gender: radioButton+ "<br>",
      Aktivitet: chosenContainer[0]
    };

    //  if (firstName != "" && lastName != "" && mobil != "" && mejl != "" && textArea != ""){
          

    //      }
  // Debug
  console.log(storedPerson); 
  // pushar sista personen i arrayen

  personArray.push(storedPerson);

  //visar personens info

  document.getElementById("showPersonDetails").innerHTML = "Du ska träna" +" "+ storedPerson.Aktivitet + " "+ "och dina uppgifter är : <br>" + (JSON.stringify(storedPerson));


  //Step 3 - en funktion för att spara arrayen och visa den i localstorage

      localStorage.setItem('personArray', JSON.stringify(personArray[i]));
    function buttonAdmin () {
    var win = window.open('file:///home/daiksaik/Desktop/Untitled%20Folder/Admin.html');
    win.focus();

  function validateForm() {
    var FN = document.forms["myForm"]["firstname"].value;
    var LN = document.forms["myForm"]["lastname"].value;
    var MO = document.forms["myForm"]["mobil"].value;
    var ME = document.forms["myForm"]["mejl"].value;
    var GE = document.forms["myForm"]["textArea"].value;
    
    if (FN == "" || LN =="" || MO =="" || ME == "" || GE == ""){
        alert("Fyll i alla textrutor");
        return false;
      }
    }
  }
}










/*


    //validateForm();
    //alert(validateForm);

    // personens objekt
    var storedPerson = {
        förnamn: firstName +"<br>", 
        Efternamn: lastName+ "<br>",
        mejl: mejl+ "<br>",
        mobil: mobil+ "<br>",
        kommentar: textArea+ "<br>",
        gender: radioButton+ "</br>",
        Aktivitet: chosenContainer[0]
    };
    // pushar sista personen i arrayen
    personArray.push(storedPerson); 
    //visar personens info
    document.getElementById("showPersonDetails").innerHTML = "Du ska träna" +" "+ storedPerson.Aktivitet + " "+ "och dina uppgifter är : <br>" + (JSON.stringify(storedPerson));
    localStorage.setItem('personArray', JSON.stringify(personArray));
  }
//Step 3 - en funktion för att spara arrayen och visa den i localstorage
function adminButton(){ 

     window.open("file:///home/daiksaik/Desktop/Untitled%20Folder/Admin.html");

   console.log("Called.");
}
function radioButtonsFunction(){

  radioButton = document.querySelector('input[name="gender"]:checked').value;
  console.log(radioButton);
}

  /* for(var i = 0; i < personArray.length; i++){
    
     var currentLi = document.createElement("LI");
     var currentTextNode = document.createTextNode(JSON.stringify(personArray));
     currentLi.appendChild(currentTextNode);
     adminPage.appendChild(currentLi);
   } */

/*function validateForm() {

    var hasError = false;

    if (firstName.value == "") {
        document.getElementById('wrongfname').style.display = "inline";
        hasError = true;
    }
    else if (firstName.value  != ""){
        document.getElementById('wrongfname').style.display = "none";
        hasError = false; 
   }
        if (lastName.value == "") {
        document.getElementById('wronglname').style.display = "inline";
        hasError = true;
    } else if (lastName.value  != "") { {
        document.getElementById('wronglname').style.display = "none";   
    }

    if (mejl.value.search(/^[a-zA-Z]+([_\.-]?[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([\.-]?[a-zA-Z0-9]+)*(\.[a-zA-Z]{2,4})+$/) == -1) {
        document.getElementById('wrongmail').style.display = "inline";
        hasError = true;
    } else {
        document.getElementById('wrongmail').style.display = "none";   
    }

    return !hasError;
  }
}
*/
              
            
!
999px

Console