Ocultando Div com JavaScript
Página 1 de 1
Ocultando Div com JavaScript
<!doctype html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Document</title>
<script type=”text/javascript”>
//Função responsavel para ocultar a div.
function ver(){
document.getElementById(“formulario”).style.display = “”;
}
function fechar(){
document.getElementById(“formulario”).style.display = “none”;
}
</script>
</head>
<body>
<input type=”submit” value=”Iniciar” onClick=”ver();” />// chamando a função ver
<input type=”submit” value=”Fechar” onClick=”fechar();” />//chamando a função fechar
function ver(){
document.getElementById(“formulario”).style.display = “”;
}
function fechar(){
document.getElementById(“formulario”).style.display = “none”;
}
</script>
</head>
<body>
<input type=”submit” value=”Iniciar” onClick=”ver();” />
<input type=”submit” value=”Fechar” onClick=”fechar();” />
<div id=”formulario”>
<form>
Nome:<input type=”texto” name=”nome”><br>
<input type=”submit” value=”enviar”>
</form>
</div>
</body>
</html>
document.getElementById(“formulario”).style.display = “”;
Identifica a div que ira receber a ação
document.getElementById(“formulario”).style.display = “”;
ação responsavel para vizualizar a Div.
obs:
a linha de fechar é o mesmo comando, com a diferença no final do comando style.display ira receber none executa a ação de ocultar a dive.
document.getElementById(“formulario”).style.display = “none“;
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Document</title>
<script type=”text/javascript”>
//Função responsavel para ocultar a div.
function ver(){
document.getElementById(“formulario”).style.display = “”;
}
function fechar(){
document.getElementById(“formulario”).style.display = “none”;
}
</script>
</head>
<body>
<input type=”submit” value=”Iniciar” onClick=”ver();” />// chamando a função ver
<input type=”submit” value=”Fechar” onClick=”fechar();” />//chamando a função fechar
function ver(){
document.getElementById(“formulario”).style.display = “”;
}
function fechar(){
document.getElementById(“formulario”).style.display = “none”;
}
</script>
</head>
<body>
<input type=”submit” value=”Iniciar” onClick=”ver();” />
<input type=”submit” value=”Fechar” onClick=”fechar();” />
<div id=”formulario”>
<form>
Nome:<input type=”texto” name=”nome”><br>
<input type=”submit” value=”enviar”>
</form>
</div>
</body>
</html>
document.getElementById(“formulario”).style.display = “”;
Identifica a div que ira receber a ação
document.getElementById(“formulario”).style.display = “”;
ação responsavel para vizualizar a Div.
obs:
a linha de fechar é o mesmo comando, com a diferença no final do comando style.display ira receber none executa a ação de ocultar a dive.
document.getElementById(“formulario”).style.display = “none“;
Tópicos semelhantes
» Janela PopUp JavaScript
» Script voltar - JavaScript
» Como Criar um Pop-up em JavaScript: Um Guia Passo a Passo
» Script voltar - JavaScript
» Como Criar um Pop-up em JavaScript: Um Guia Passo a Passo
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|