masquer un élément
J'utilise javascript pour masquer dynamiquement un ensemble de paramètres
dans une interface de configuration quand on modifie un SELECT. Par
contre, je me demande comment masquer les paramètres au chargement, selon
la position du SELECT (c'est à dire selon la configuration active...).
Des idées ?
Voici la partie qui appelle le script (généré par un cgi):
<select name="luntype"
onchange="updateSel('lunedit','luntype','lunparams ' );">
8 <option value="nullio">Null (accès simulé pour test)</option>
<option value="fileio" selected="selected">Fichier local sur
disque</option>
</select>
Et voici le javascript correspondant :
//
function updateSel(whichForm , whichSel, whichLayer) {
// var myform = document.forms.getElementById( whichForm );
// var mysel = document.getElementById( whichSel );
var myform = document.forms[whichForm]
var id = myform[whichSel].options.selectedIndex;
//alert("if "+whichForm+" form "+myform+" isel "+whichSel+" sel "+id);
if (id == 0 ) {
HideLayer( whichLayer )
} else {
ShowLayer( whichLayer );
}
}
function ShowLayer( whichLayer )
{
var elem, vis;
elem = document.getElementById( whichLayer );
vis = elem.style;
vis.display = 'block';
}
function HideLayer( whichLayer )
{
var elem, vis;
elem = document.getElementById( whichLayer );
vis = elem.style;
vis.display = 'none';
}
--
Si non confectus non reficiat.
|