Tuesday, 1 August 2017

Tombol radio dari form input teks menggunakan java script


Hai,

saya memiliki tombol radio dan kolom teks
jika tombol radio dipilih bidang teks dinonaktifkan
dan jika tombol radio dari kolom teks yang dipilih bidang teks diaktifkan


<?php
$image=$_POST['image'];
$Objection=$_POST['Objection'];
if(isset($image))
{ echo"$image <br> $Objection";}
?>

<script type="text/javascript">
var textbox = function(me,field){
  if(me.checked == false){
    var textb = document.createElement('input');
    textb.type = "text";
    textb.name = field;
    me.parentNode.appendChild(textb);
  }
  setInterval(function(){
    if(me.checked == false){
       me.parentNode.removeChild(textb);
       return false;
    }
  }, 50);
};
</script>

<body>
<form action="noldepan.php" method="post">
<table width="100%">
<tr bgcolor="#e8e8e8">
<TD WIDTH="36%">
Pilih</TD>
<TD WIDTH="64%" valign="top">
<input name="Objection" type="radio" value="3">3 in evidence.<br />
<input name="Objection" type="radio" value="2">2 in evidence.<br />
<input name="Objection" type="radio" value="1">1 in evidence.<br />
<input name="Objection" type="radio" value="0">0 in evidence.<br />
<input name="Objection" type="radio" onmouseup="textbox(this,'Objection')"/>Other:<noscript>
<input name="Objection" type="text" width="250" required/></noscript>
</TD>
</tr>
<tr>
<td>       <input type="submit" value="Submit" name="image"></td>
</tr>

</table>
</form>

No comments:

Post a Comment