Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- function appendNewText()
- {
- var nums = Math.floor(Math.random()*1000);
- var newText = document.getElementById('getNamaKota').value;
- var newlist="<li id='"+nums+"'>"+newText + " <a href=\"#\" onclick=hapus("+nums+")>Hapus</a></li>";
- var para = document.getElementById("list-nama-kota").innerHTML;
- document.getElementById("list-nama-kota").innerHTML=newlist+para;
- }
- function hapus(id)
- {
- document.getElementById(id).style.display = "none";
- }
- </script>
- </head>
- <body>
- <input type="text" id="getNamaKota"><input type="button" value="append Text" onclick="appendNewText()"/>
- <ul id='list-nama-kota'>
- </ul>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement