Javascript

footer59 Messages postés 5 Statut Membre -  
Alain_42 Messages postés 5413 Statut Membre -
salut ! qui peux m'aider pour ces lignes

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><!-- Insert your title here --></title>
<script type="text/javascript">
function montrer(element)
{

var les_elements = new array("apropos","inscrption","liens-utiles","contact");
for (var i=0 ; i<les_elements.length; i++)
document.getElementById(les_elements[i]).style.display='none';

document.getElementById(element).style.display='block';

}

</script>
<style type="text/css">
body {
font-family: verdana;
font-size: 12px;

}
#conteneur{

width:800px;
background:red;
margin: auto;
}

#haut{

height: 130px;
background: yellow;
padding: 10px;

}

#liens{

height: 25px;
background: red;
padding:5px;

}

#milieu{

height: 400px;
background: #ddd;
padding: 10px;

}

#bas{
width:auto;
height: 50px;
background:pink;

}

#liens a{
display: block;
background:green;
margin-right: 5px;
padding: 5px;
float: left;
width:100px;
text-align: center;
color: #fff;
}

#liens a:hover{

background:orange;
}

#apropos,
#inscription,
#liens-utiles,
#conctact{ display: none; }

</style>
</head>
<body>
<!-- Insert your content here -->

<div id="conteneur">

<div id="haut">
<h4> mon logo</h4>
</div>
<div id="liens">
<a href="javascript:montrer('apropos')">a propo de page </a>
<a href="javascript:montrer('s'inscription')">s'incrire </a>
<a href="javascript:montrer('liens-utiles')">liens </a>
<a href="javascript:montrer('conctact')">contact </a>
</div>

<div id="milieu">
<div id='apropos'>

bonjour<br>
je m'appelle paluku kasai
<br></br>
</div>

<div id='inscription'>
<form action='' methode='POST'>
username:<input type='text' name='username'></br>
Password:<input type='text' name=' Password'></br>
<input type='submit' value='login'>
</form> <p>

</div>

<div id="liens-utiles">

</div>

<div id="contact">

</div>

</div>

<div id="bas">
le bas de page
</dv>

</div>

</body>
</html>

1 réponse

  1. Alain_42 Messages postés 5413 Statut Membre 904
     
    Salut, un peu plus de rigueur tu as fait plein de fautes de frappe voir commentaires ( et j'en ai peu être oublié)

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title><!-- Insert your title here --></title>
    <script type="text/javascript">
    function montrer(element)
    {
    //ci dessous ERREUR tu as mis inscrption au lieu de inscription
    var les_elements = new array("apropos","inscription","liens-utiles","contact");
    for (var i=0 ; i<les_elements.length; i++){
    	//mets toujours les {} ça t'évitera des pb si tu dois rajouter une instruction
    	//la ligne ci dessous masque les éléments eventuellement visibles
    	if( document.getElementById(les_elements[i]).style.display=='block'){document.getElementById(les_elements[i]).style.display='none';}
    }
    	//la ligne ci dessous "demasque" l'élément passé en argument lors du click sur le lien
    document.getElementById(element).style.display='block';
    }
    
    </script>
    <style type="text/css">
    body {
    	font-family: verdana;
    	font-size: 12px;
    }
    #conteneur{
    	width:800px;
    	background:red;
    	margin: auto;
    }
    #haut{
    	height: 130px;
    	background: yellow;
    	padding: 10px;
    }
    #liens{
    	height: 25px;
    	background: red;
    	padding:5px;
    }
    #milieu{
    	height: 400px;
    	background: #ddd;
    	padding: 10px;
    }
    #bas{
    	width:auto;
    	height: 50px;
    	background:pink;
    
    }
    #liens a{
    	display: block;
    	background:green;
    	margin-right: 5px;
    	padding: 5px;
    	float: left;
    	width:100px;
    	text-align: center;
    	color: #fff;
    }
    
    #liens a:hover{
    
    background:orange;
    }
    /* ci dessous ERREUR tu as mis conctact au lieu de contact */
    #apropos,#inscription,#liens-utiles,#conctact{ 
    	display: none;
    }
    
    
    
    
    </style>
    </head>
    <body>
    <!-- Insert your content here -->
    
    <div id="conteneur">
    
    <div id="haut">
    <h4> mon logo</h4>
    </div>
    <div id="liens">
    <a href="javascript:montrer('apropos')">a propo de page </a>
    <a href="javascript:montrer('s'inscription')">s'incrire </a>
    <a href="javascript:montrer('liens-utiles')">liens </a>
    <a href="javascript:montrer('contact')">contact </a>
    </div>
    
    <div id="milieu">
    <div id='apropos'>
    
    bonjour<br>
    je m'appelle paluku kasai
    <br></br>
    </div>
    
    <div id='inscription'>
    <!-- ci dessous ERREUR c'est method et pas methode -->
    <form action='' method='POST'>
    username:<input type='text' name='username'></br>
    Password:<input type='text' name=' Password'></br>
    <input type='submit' value='login'>
    </form> <p>
    
    
    </div>
    
    <div id="liens-utiles">
    
    </div>
    
    <div id="contact">
    
    
    </div>
    
    </div>
    
    <div id="bas">
    le bas de page
    </div>
    
    </div>
    
    
    
    </body>
    </html>
    0