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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
<html>
<head>
<title>HTML5:Palette d'images </title>
<STYLE TYPE="text/css">
<!--
TD{font-family: Arial, Helvetica, sans-serif; font-size: 8pt;}
--->
</STYLE>
<style type="text/css">
<!--
.bandehaute {
//fond de la bande
background-color: #7B7B7B; //couleur grise
background-position: 0px -545px;
//sépare le contenu d'un élément de sa bordure gauche.
padding-left: 10px;
font-weight: bold;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 1px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: solid;
border-left-style: none;
//la couleur de la bordure
border-top-color: #B06C27;
border-bottom-color: #B06C27;
//la taille du titre
font-size: 12px;
}
.remplissage {
margin: 0px;
padding-top: 0px;
padding-right: 10px;
padding-bottom: 0px;
padding-left: 10px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.bordure {
border: 1px solid #cccccc;
}
.images { //choisir les dimensions des vignettes
height:150px;
width:150px;
border:0px;
margin:15px 15px 0 0;
}
-->
</style>
<style type="text/css">
table, td
{
border-color: #7B7B7B;
border-style: solid;
}
</style>
<script>
//la fonction permettant de selectionner les images
function SelectionImage(mesFichiers) {
for (var i = 0, f; f = mesFichiers[i]; i++) {
var imageReader = new FileReader();
imageReader.onload = (function(fichier) {
return function(e) {
var span = document.createElement('span');
span.innerHTML = ['<img class="images" src="', e.target.result,'" title="', fichier.name, '"/>'].join('');
document.getElementById('thumbs').insertBefore(span, null);
};
})(f);
imageReader.readAsDataURL(f);
}
}
//fonction qui permet de déposer les images
function deposer(e) {
SelectionImage(e.dataTransfer.files);
e.stopPropagation();
e.preventDefault();
}
</script>
</head>
<body>
<center>
<!-- width largeur de la bande, largeur du bord
- cellpadding : Spécifie l'espace en pixels entre la bordure et le contenu de la cellule du tableau
- cellspacing : Spécifie l'espace en pixels entre les cellules du tableau -->
<table width="700" border="10" cellspacing=1 cellpadding=5>
<tr bgcolor="#5D292D">
<!-- placement du titre a gauche -->
<td class="bandehaute" align="left">
<p>Palette miniatures d'images</p>
</td>
</tr>
<tr>
<!-- //aligner les images du gauche à droite -->
<td align="left" height="105" ondragenter="return false" ondragover="return false" ondrop="deposer(event)"> <output id="thumbs"></output>
</td>
</tr>
<tr>
<td align="center">
<!-- //bouton parcourir avec choix multiple -->
<p> Glisser-déposer ou choisir des images : <input type="file" id="input" size="10" multiple="true" onchange="SelectionImage(this.files)" /></p>
</td>
</tr>
</table>
</center>
</body>
</html> |
Partager