Skip to content

Instantly share code, notes, and snippets.

/gist:3105f4f6b9a6bded949b Secret

Created Jul 27, 2010
What would you like to do?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="fr" lang="fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
var blocs = new Array('texte_image1','texte_image2','texte_image3');
function hideAll() {
for(x in blocs) {
document.getElementById(blocs[x]).style.display = 'none';
function display(id) {
var div = document.getElementById(id); = ( == 'none') ? 'block' : 'none' ;
<style type="text/css">
.hidden { display: none; }
<input type="button" value="Afficher n°1" onclick="display('texte_image1')" />
<input type="button" value="Afficher n°2" onclick="display('texte_image2')" />
<input type="button" value="Afficher n°3" onclick="display('texte_image3')" />
<div id="texte_image1" class="hidden">Contenu de premier div</div>
<div id="texte_image2" class="hidden">Contenu de second div</div>
<div id="texte_image3" class="hidden">Contenu de troisième div</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment