-2
echo " <td><label for=\"opcao1\"></label></td>";
echo " <td><input name=\"origem\" value=\"Azul\" id=\"Azul\" type=\"radio\" onclick=\"if(document.getElementById('textOutrosOrigem').disabled==false){document.getElementById('textOutrosOrigem').disabled=true;}\">Azul</td>";
echo " </tr>";
echo " <tr>";
echo " <td><label for=\"opcao2\">Origem</label></td>";
echo " <td><input name=\"origem\" value=\"Vermelho\" id=\"Vermelho\" type=\"radio\" onclick=\"if(document.getElementById('textOutrosOrigem').disabled==false){document.getElementById('textOutrosOrigem').disabled=true;}\">Vermelho</td>";
echo " </tr>";
echo " <tr>";
echo " <td><label for=\"opcao3\"></label></td>";
echo " <td><input name=\"origem\" value=\"outros\" id=\"outros\" type=\"radio\" onclick=\"if(document.getElementById('textOutrosOrigem').disabled==true){document.getElementById('textOutrosOrigem').disabled=false;}\">";
echo " Outros<input name=\"textOutrosOrigem\" size=\"20\" id=\"textOutrosOrigem\" type=\"text\" style=\"width: 100%;\" \"height: 120px;\" disabled=\"disabled\"></br></br></td>";
echo " </tr>";
Javascript
<script type="text/javascript">
window.onload = function () {
document.getElementById('outros').onchange = habilitarCampo;
}
function habilitarCampo(){
alert('dffwdfd');
if document.getElementById('outros').checked == false;
{
document.getElementById('textOutrosOrigem').disabled = true;
document.getElementById('textOutrosOrigem').text = '';
}
else
{
document.getElementById('textOutrosOrigem').disabled = false;
}
}
If you can put your code in an online editor for better understanding, such as http://phpfiddle.org/
– Julyano Felipe
Code http://www.codepen.io so we can better understand what you are doing.
– KingRider