Créer un compte
Connexion

Afficher/Cacher

Pour créer et répondre aux sujets, vous devez être connecté.
Pages: 1
Auteur Message
TimRuiz
25/03/2012 à 10:29:45
TimRuiz
Membre
Salut!

J'utilise votre script Javascript pour Afficher ou Cacher une zone de texte. Et je voudrai qu'à l'ouverture de la page le texte soit Affiché et non pas caché.

Page: afficher_cacher_div.js
function afficher_cacher(id)
{
        if(document.getElementById(id).style.visibility=="hidden")
        {
                document.getElementById(id).style.visibility="visible";
                document.getElementById('bouton_'+id).innerHTML='Cacher la pub';
        }
        else
        {
                document.getElementById(id).style.visibility="hidden";
                document.getElementById('bouton_'+id).innerHTML='Afficher la pub';
        }
        return true;
}

Page: pub.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<title>></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script type="text/javascript" src="afficher_cacher_div.js"></script>
</head>
<body>
<span class="bouton" id="bouton_texte" onclick="javascript:afficher_cacher('texte');">Masquer la pub</span>
        <div id="texte" class="texte">
<div class="pub">Pour afficher votre pub cliquez <a href="http://form.jotformeu.com/form/20803984035352">ici</a></div> <!--pub-->
</div>
        <script type="text/javascript">
        //<!--
                afficher_cacher('texte');
        //-->
        </script>

</body>
</html>


Pages: 1