const btnWeiterleiten = document.getElementById('Lesen');
const btnSpeichern = document.getElementById('Speichern');
const btnLoeschenKey = document.getElementById('delete_key');
const btnAllesLoeschen = document.getElementById('delete_all');



function speichern() {
	var key = document.getElementById('key').value;
	var data = document.getElementById('data').value;
	window.localStorage.setItem(key, data);
	alert(data);
}

function weiterleiten() {

	window.open('eintraege.html','Lesen');
}

btnSpeichern.addEventListener('click',  e => {
	speichern()});

btnWeiterleiten.addEventListener('click',  e => {
	weiterleiten()});


  function loeschen() {
    var key = document.getElementById('key').value;
	window.localStorage.removeItem(key);
	alert(key);
}

function allesLoeschen() {
	window.localStorage.clear();
}

btnLoeschenKey.onclick
btnLoeschenKey.addEventListener('click',  e => {
	loeschen()});

btnAllesLoeschen.addEventListener('click',  e => {
	allesLoeschen()});




