1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| <!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="fr" >
<head>
<title>Bienvenue sur mon site !</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
body
{
background-color: #8fc3cb;
padding-left: 30%;
}
fieldset
{
border: none;
}
#testbox
{
border: thin dotted black;
position: absolute;
top: 10%;
left: 30%;
width: 300px;
height: 202px;
}
.javascript
{
position: absolute;
top: 50%;
left: 30%;
width: 300px;
text-align: center;
}
</style>
<script language="javascript">
<!--
function add()
{
var nbrInput = document.getElementsByTagName("input");
var nbr = nbrInput.length;
var lien = document.getElementById("zone_text");
var input = document.createElement("input");
input.setAttribute("type","text");
input.setAttribute("class","lien");
var saut = document.createElement("br");
var supprimer = document.createElement("a");
var supp = document.createTextNode("Supprimer");
supprimer.appendChild(supp);
supprimer.setAttribute("href","#");
supprimer.setAttribute("id",nbr);
if(document.all) supprimer.attachEvent("onClick",del);
else supprimer.addEventListener("click",del,true);
lien.appendChild(input);
lien.appendChild(supprimer);
lien.appendChild(saut);
}
function del(event)
{
var node = document.getElementById("input");
var parent = node.parentNode;
parent.removeChild(node);
var node = document.getElementById("a");
var parent = node.parentNode;
parent.removeChild(node);
}
//-->
</script>
</head>
<body>
<p id="testbox">If you see information appearing in the current box when you click in a text field javascript is enabled on your computer</p>
<div class="javascript">
<form method="post">
<fieldset id="zone_text">
<p class="lien" onClick="javascript:add()">Ajouter un champ texte</p><br />
</fieldset>
</form>
</p>
<script type="text/javascript">
</script>
</body>
</html> |
Partager