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
|
<html>
<head>
<script type="text/javascript">
function carcpix()
{
divcache=document.getElementById("CACHE");
divcache.innerHTML=document.getElementById('yvert').value+document.getElementById('descrip').value;
var NETSCAPE = (navigator.appName == "Netscape");
var Obj = document.getElementById('CACHE');
if(NETSCAPE)
{
Larg= Obj.offsetWidth;
}
else
{
Larg= Obj.scrollWidth;
}
divtaill=document.getElementById("taillediv");
divtaill.innerHTML=Larg;
var descrip = document.getElementById('yvert').value+document.getElementById('descrip').value;
if(Larg<210)
{
var diff = parseInt(210) - parseInt(Larg);
var nbTours = parseInt(diff) / parseInt(2);
var nbTours = Math.round(nbTours,0);
for(i=0; i<nbTours; i++)
{
descrip = descrip+".";
}
document.forms.newproduit.descripPDF.value=descrip;
}
if(Larg>210)
{
var rapport = parseInt(Larg) / parseInt(210);
var rapportsup = Math.ceil(rapport);
var maxtotal = parseInt(210) * parseInt(rapportsup);
var diff = parseInt(maxtotal) - parseInt(Larg);
var nbTours = parseInt(diff) / parseInt(2);
var nbTours = Math.round(nbTours,0);
for(i=0; i<nbTours; i++)
{
descrip = descrip+".";
}
document.forms.newproduit.descripPDF.value=descrip;
}
divcache.innerHTML = descrip;
var NETSCAPE = (navigator.appName == "Netscape");
var Obj = document.getElementById('CACHE');
if(NETSCAPE)
{
Larg= Obj.offsetWidth;
}
else
{
Larg= Obj.scrollWidth;
}
divtaill.innerHTML=Larg;
}
</script>
</head>
<body>
<form name="newproduit" method="post" enctype="multipart/form-data">
N° Yvert <input maxlength="255" size="3" type="text" name="yvert" id="yvert" onKeyDown="carcpix();" onKeyUp="carcpix();">
<br />
Description
<textarea name="descrip" id="descrip" cols="70" rows="7" wrap="soft" onKeyDown="carcpix();" onKeyUp="carcpix();" ></textarea>
<br />
<textarea style="visibility:visible;"name="descripPDF" id="descripPDF" wrap="soft"></textarea>
<br />
<input type="button" name="button" value="Envoi">
</form>
<br />
<span id="CACHE" style="width:auto; background-color:#993399; visibility:visible; font:Arial; font-size:8px;"></span>
<br />
<div>La taille de la div est de <span id="taillediv"></span> px</div>
</body>
</html> |
Partager