Template:Paris/Toggle

From 2008.igem.org

(Difference between revisions)
(Replacing page with '<div class="toggleswitch">↓ {{{1}}}↑ </div> <div>{{:Team:Paris/{{{2}}}}}</div>')
Line 1: Line 1:
-
<html>
+
<div class="toggleswitch">↓ {{{1}}}↑ </div>
-
<script type="text/javascript">
+
<div>{{:Team:Paris/{{{2}}}}}</div>
-
function toggleNext(el) {
+
-
var next=el.nextSibling;
+
-
while(next.nodeType != 1) next=next.nextSibling;
+
-
next.style.display=((next.style.display=="none") ? "block" : "none");
+
-
}
+
-
 
+
-
function getElementsByTagAndClassName(tag,cname) {
+
-
var tags=document.getElementsByTagName(tag);
+
-
var cEls=new Array();
+
-
for (i=0; i<tags.length; i++) {
+
-
  var rE = new RegExp("(^|\s)" + cname + "(\s|$)");
+
-
  if (rE.test(tags[i].className)) {
+
-
  cEls.push(tags[i]);
+
-
  }
+
-
  }
+
-
return cEls;
+
-
}
+
-
function toggleNextByTagAndClassName(tag,cname) {
+
-
var ccn="button";
+
-
clickers=getElementsByTagAndClassName(tag,cname);
+
-
for (i=0; i<clickers.length; i++) {
+
-
  clickers[i].className+=" "+ccn;
+
-
  clickers[i].onclick=function() {toggleNext(this)}
+
-
  toggleNext(clickers[i]);
+
-
}
+
-
}
+
-
window.onload=function(){toggleNextByTagAndClassName('div','toggleswitch')}
+
-
</script>
+
-
<div class="toggleswitch">↓ {{{1}}} ↑</div>
+
-
<div></html>{{:Team:Paris/{{{2}}}}}<html></div>
+
-
</html>
+

Revision as of 17:25, 26 October 2008

↓ {{{1}}}↑
{{:Team:Paris/{{{2}}}}}