pourquoi ce code ne fonctionne t'il pas sur opera ?
cad, la fonction javascript qui limite le nombre de ligne a la hauteur du champ
Modifié par gforce (10 Jan 2007 - 17:58)

cad, la fonction javascript qui limite le nombre de ligne a la hauteur du champ
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Count lines</title>
<script type="text/javascript">
function limit(o) {
while (o.scrollHeight > o.offsetHeight) {
o.value = o.value.substring(0, o.value.length-2)
}
}
</script>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" name="form">
<textarea name="field" wrap="hard" style="font-family:courier;font-size:12px;" cols="64" rows="29" onchange="limit(this);" onkeyup="limit(this);"><?php echo $_POST['field'];?></textarea>
<input type="submit" value="print" />
</form>
<div style="font-family:courier;font-size:12px;">
<?php
$trans = array(" " => " ");
echo nl2br(strtr($_POST['field'], $trans));
?>
</div>
</body>
</html>
Modifié par gforce (10 Jan 2007 - 17:58)