Html+Java Düzenli Liste yapımı
Ve kodları yazıyoruz...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
ul li{
background-color: teal;
list-style: none;
font-size: 25px;
color: aliceblue;
width: 400px;
text-align: left,center;
border: 5px solid grey;
margin-bottom: 10px;
padding: 10px 15px;
list-style-type: none;
}
li button{
float: right;
}
</style>
</head>
<body>
<input type="text" name="" id="yazi" >
<button onclick="ad()">Ekle</button>
<ul id="liste">
</ul>
<script>
var listec=document.getElementById("liste");
var lan=document.getElementById("yazi");
function ad(){
var lisitem=document.createElement("li");
lisitem.innerHTML=lan.value+"<button onclick='this.parentElement.remove()'>Sil</button>"
listec.append(lisitem);
lan.value="";
}
</script>
</body>
</html>
Yorumlar
Yorum Gönder