/ Published in: JavaScript
javascript in_array object frame.
Usar:
Mediceau.Navegacion.marcar(['nav1','nav2'])
...
_--Nav 1
_--Nav 2
_--Nav 3
_--Nav 4
Usar:
Mediceau.Navegacion.marcar(['nav1','nav2'])
...
_--Nav 1
_--Nav 2
_--Nav 3
_--Nav 4
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var Mediceau = document.Mediceau || {}; function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function in_array(array,elemento){ for(var i in array){ if(array[i]==elemento) return true;} return false; } Mediceau.Navegacion = { frame: window.parent.frameNavegacion, secciones: new Array("nav_actua","nav_quienes","nav_info","nav_documentos","nav_etudes","nav_robinet","nav_salle","nav_salle_documents","nav_affiches","nav_robinet2","nav_apprendre","nav_espace"), marcar: function(cual){ for (var i=0; i < Mediceau.Navegacion.secciones.length; i++) { obj = MM_findObj(Mediceau.Navegacion.secciones[i], Mediceau.Navegacion.frame.document ); if( in_array( cual, Mediceau.Navegacion.secciones[i] ) ){ obj.style.display = 'block'; }else{ obj.style.display = 'none'; } } } }