Menampilkan Text Box Berdasarkan Combo Yang dipilh



<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

<script>
function tampilkan(){
  var id_user=document.getElementById("form1").kategori.value;
  if (id_user=="ID-100")
    {
        document.getElementById("nama").value = 'Ali';
        document.getElementById("email").value = 'ali@gmail.com';
    }
  else if (id_user=="ID-200")
    {
       document.getElementById("nama").value = 'Joko';
      document.getElementById("email").value = 'joko@gmail.com';
    }
}
</script>

</head>
<body>
<h2>Suckittrees.com</h2>
<form id="form1" name="form1" onsubmit="return false">
  <label>Pilih Kategori: </label>
  <select id="kategori" name="kategori" onchange="tampilkan()">
    <option value='0' disabled="disabled" selected/>Pilih</option>
    <option value="ID-100">ID-100</option>
    <option value="ID-200">ID-200</option>
  </select>
  <br/><br/>
   <label>Nama : </label> <input type='text' id="nama" name="nama"><br/><br/>
   <label>Email : </label> <input type='text' id="email" name="email">
</form>
<br/>
<br/>

keywords : Combobox dipilih text keluar hasil | Menampilkan Text Box Berdasarkan Combo Yang dipilh

Subscribe to receive free email updates:

0 Response to "Menampilkan Text Box Berdasarkan Combo Yang dipilh"

Posting Komentar