[Resolvido] Formulario dinamico
Pessoal, queria construir um formulario dinamico onde o usuario ao clicar em um radio, aparece uma caixa de texto... mas não estou conseguindo
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="">
<title>Untitled 1</title>
</head>
<script>
function add(){
//adiciona a caixa de texto ao form
var inputElement = this;
var addElement = document.getElementById("link");
// addElement.appendChild(inputElement);
var newSpanElement = document.createElement("span");
newSpanElement.className = "rank";
var newTextElement = document.createTextNode("input");
newSpanElement.appendChild(newTextElement);
addElement.insertBefore(newSpanElement,inputElement);
}
</script>
<body>
<form name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><label>
<input type="radio" name="tipo" value="link" id="tipo" onclick="add();" />
Link</label>
<label>
<input type="radio" name="tipo" value="pagina" id="tipo"/>
Página</label></td>
</tr>
<tr class="titulocampo">
<td>Nome do Link:</td>
</tr>
<tr>
<td><label>
<div id="link" name="link">
</div>
</label></td>
</tr>
</form>
</body>
</html>Discussão (5)
Carregando comentários...