Javascript menghitung kata, karakter, dan kalimat.
Haloo gaan, kali ini saya mau ngasih tau nih, cara bikin program html + javascript untuk menghitung jumlah Kata dan Kalimat. barangkali aja anda disuruh buat program kayak ginian hehe, soalnya saya disuruh buat nih.
oke langsung saja liat code nya.... cekidot. :
Script :
<html>
<head>
<title>Fucking Program Language </title> <!-- DONT TELL ME IF U DISLIKE THIS TITLE. JUST SHUT. SHIIIIIIT -->
<style>
fieldset {width:400px;
background-color:#333;
border-top:11px solid maroon;
border-radius:20px 10px;
margin:auto;
transition:2s;}
fieldset:hover {box-shadow:5px 8px 11px maroon;
padding:10px;
margin:auto;}
td {padding:10px;
text-align:left;
color:white;
}
textarea {background-color:#404040;
color:white;
width:450px;
height:90px;
max-width:450px;
max-height:90px;
font-family:calibri;
border:1px inset #262626;
padding:7px;}
table {border-collapse:collapse;}
th, td {border-bottom:1px solid maroon;}
button {background-color:maroon;
color:black;
font-family:courier;
border:1px solid maroon;
border-radius:5px 5px;
transition:2s;
cursor:pointer;}
button:hover {padding:13 30;
background-color:firebrick;
color:white;
font-weight:bold;
font-size:16px;
border-radius:10px 5px;}
</style>
<body>
<script>
function Cek1() {
var content1 = document.leader.area1.value;
var karakter = content1.length;
document.leader.hasil1.value=karakter
}
function Cek2() {
var content2 = document.leader.area2.value;
var kata = content2.split(" ");
document.leader.hasil2.value=kata.length
}
function Cek3() {
var conten3 = document.leader.area3.value;
var kalimat = conten3.split(" ");
document.leader.hasil3.value=kalimat.length
}
</script>
<br><br>
<fieldset>
<table> <!-- FUCK THIS. U STUNNED MY MIND. WHY U BORN AT HTML?? I DONT NEED YOUU. -->
<form name="leader"> <!-- WHY U NOT TELLING ME THAT I SHOULD USE YOUUU FORMY WORMYY!!!? -->
<tr>
<td style="vertical-align:top;font-family:calibri;color:#e60000;"> Karakter </td>
<td> <textarea name="area1">Muhamad Ahmadin</textarea> </td>
<td> <button type="button" onClick="Cek1()"> Hitung </button></td>
<td> <input style="border-radius:9px 9px;padding:6px;" type="text" name="hasil1" disabled> </td>
</tr>
<tr>
<td style="vertical-align:top;font-family:calibri;color:#e60000;"> Kata </td>
<td> <textarea name="area2">My name is Muhamad Ahmadin</textarea> </td>
<td> <button type="button" onClick="Cek2()"> Hitung </button> </td>
<td> <input style="border-radius:9px 9px;padding:6px;" type="text" name="hasil2" disabled> </td>
</tr>
<tr>
<td style="vertical-align:top;font-family:calibri;color:#e60000;"> Kalimat </td>
<td> <textarea name="area3">Muhamad Ahmadin From Software Engineering C Stemanika</textarea> </td>
<td> <button type="button" onClick="Cek3()"> Hitung </button> </td>
<td> <input style="border-radius:9px 9px;padding:6px;" type="text" name="hasil3" disabled> </td>
</tr> </form>
</table> <!-- SHITTY TAG NAME. I WOULD NEVER USE THIS SHIT EVER . FUCK YEAH -->
</fieldset>
<br>
<div style="border-top:6px solid #800000;
width:60%;
margin:auto;
border-radius:111px;"> </div> <br><br>
</body>
</html>
Hasilnya seperti ini :
Oke lah, begitu saja dari saya, semoga bermanfaat gans :D
1 comments:
commentsmantapp gann
Reply