Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Form Dinamiche

Una Form con dei campi che possono essere visualizzati o meno in base alle esigenze.


¤ Clicca qui per visualizzare la demo... ¤

<html>
<head>
</head>
<body>
<span id="divt1" style="visibility:visible; position:relative; top:0; left:0">
<form action="javascript:#">

Type 1 Input:
<input name="t1" type="text" value="">
</form>
</span>
<span id="divt2" style="visibility:visible; position:relative; top:0; left:0;">
<form action="javascript:#">
Type 2 Input:
<input name="t2" type="text" value="">
</form>
</span>
<form>
Type 1 Visible
<input name="r1" type="radio" checked value="" onClick="toggleT('divt1','s')">
Hidden
<input name="r1" type="radio" value="" onClick="toggleT('divt1','h')"><br>
Type 2 Visible
<input name="r2" type="radio" checked value="" onClick="toggleT('divt2','s')">
Hidden
<input name="r2" type="radio" value="" onClick="toggleT('divt2','h')">
</form>

<script type=text/javascript>


  // _w : which ID (1) or (2)
  // _h : (h)ide or (s)how


function toggleT(_w,_h)
{
  if
(document.all)
  { // è IE
    if (_h == 's') eval("document.all." + _w + ".style.visibility='visible';");
    if (_h == 'h') eval("document.all." + _w + ".style.visibility='hidden';");
  }
  else
  {
// non è IE
    if (_h == 's') eval("document.layers['" + _w + "'].visibility='show';");
    if (_h == 'h') eval("document.layers['" + _w + "'].visibility='hide';");
  }
}


</script>

</body>
</html>



Scarica il Codice...


Stampa la pagina


 

Inizio pagina

risorse per webmaster