Advertisement
Chalief

jongol

May 5th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. <html>
  2. <title>Belajar JAVASCRIPT</title>
  3. <link rel="stylesheet" href="css.css">
  4. <body>
  5. <main>
  6. <center><header>Javascript</header></center><hr>
  7. <script language = "javascript" src="js external.js"></script>
  8. </scri
  9. <hr>
  10. <form name="fdata">
  11. <pre>
  12. <center>
  13. Memasukkan Data Dengan Teks<br>
  14. Nama Lengkap :<input type = "text" name = "nama"/><br>
  15. Tempat Lahir :<input type = "text" name = "tempat"/><br>
  16. Tanggal Lahir :<input type = "text" name = "tanggal"/><br>
  17. Jenis Kelamin :<input type="radio" name="jkl" value="laki-laki">Laki-laki <input type="radio" name="jkp" value="perempuan">Perempuan
  18. Telp/Hp :<input type = "text" name = "telp"/><br>
  19. Alamat :<textarea name="alamat" rows=2 cols=20></textarea>
  20. </pre>
  21. <center>
  22. <input type = "button" value = "Send" onClick = "tekan()"/>
  23. <input type = "reset" value = "Reset">
  24. <hr width=800 color=#169f77>
  25. <pre>
  26. <center>
  27. Output<br>
  28. Nama :<input type = "text" name = "nama1"/><br>
  29. Tempat Lahir :<input type = "text" name = "tempat1"/><br>
  30. Tanggal Lahir :<input type = "text" name = "tanggal1"/><br>
  31. jenis Kelamin :<input type = "text" name="jenkel"><br>
  32. Telp/Hp :<input type = "text" name = "telp1"/><br>
  33. Alamat :<input type = "text" name = "alamat1" />
  34. </pre>
  35. </form>
  36. <script language="Javascript">
  37. function tekan(){
  38. var namastr= (document.fdata.nama.value);
  39. var tempatstr= (document.fdata.tempat.value);
  40. var tanggalstr= (document.fdata.tanggal.value);
  41. var telpstr= (document.fdata.telp.value);
  42. var alamatstr= (document.fdata.alamat.value);
  43. document.fdata.nama1.value= namastr;
  44. document.fdata.tempat1.value= tempatstr;
  45. document.fdata.tanggal1.value= tanggalstr;
  46. document.fdata.telp1.value= telpstr;
  47. document.fdata.alamat1.value= alamatstr;
  48. var jklstr= (document.fdata.jkl.value);
  49. var jkpstr= (document.fdata.jkp.value);
  50.  
  51.  
  52. if(document.fdata.jkl.checked==1)
  53. {
  54. if (document.fdata.jkp.checked==1)
  55. {
  56. document.fdata.jenkel.value=jklstr;
  57. document.fdata.jenkel.value=jkpstr;
  58. document.fdata.jenkel.value=0;
  59. alert('Anda Memilih 2 Jenis Kelamin coba lagi ya')
  60. }
  61. else
  62. {document.fdata.jenkel.value=jklstr}}
  63.  
  64. else if(document.fdata.jkp.checked==1)
  65. {document.fdata.jenkel.value=jkpstr}
  66.  
  67. else
  68. {alert('Anda Belum Memilih')}}
  69.  
  70.  
  71.  
  72. </script>
  73. </main>
  74.  
  75. </body>
  76. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement