c. php javascript
- r3ynz_t4nz
- Born


- Inscription: Oct 02, 2008
- Messages: 1
- Status: Offline
quelqu'un peut-il m'aider., et de traduire ou de générer le code javascript dans php ..,
<html>
<head>
<title> </title>
</head>
<body>
<form name="my_form" method="post">
<textarea onKeyPress=check_length(my_form);
onKeyDown=check_length(my_form);
name="my_text"
rows=4 cols=30>
</textarea>
<br>
<input size=1 value=50 name=text_num> Characters Left
</form>
<script language=JavaScript>
function check_length(my_form){
maxLen = 50;
if ( my_form.my_text.value.length >= maxLen ) {
var msg = "You have reached your maximum limit of characters allowed";
alert(msg);
my_form.my_text.value = my_form.my_text.value.substring(0, maxLen);
}
else {
my_form.text_num.value = maxLen - my_form.my_text.value.length;
}
}
</script>
</body>
</html>
- <html>
- <head>
- <title> </title>
- </head>
- <body>
- <form name="my_form" method="post">
- <textarea onKeyPress=check_length(my_form);
- onKeyDown=check_length(my_form);
- name="my_text"
- rows=4 cols=30>
-
- </textarea>
- <br>
- <input size=1 value=50 name=text_num> Characters Left
- </form>
- <script language=JavaScript>
- function check_length(my_form){
- maxLen = 50;
- if ( my_form.my_text.value.length >= maxLen ) {
- var msg = "You have reached your maximum limit of characters allowed";
-
- alert(msg);
- my_form.my_text.value = my_form.my_text.value.substring(0, maxLen);
- }
- else {
- my_form.text_num.value = maxLen - my_form.my_text.value.length;
-
- }
- }
- </script>
- </body>
- </html>
merci.,.
reynz
- Anonymous
- Bot


- Inscription: 25 Feb 2008
- Messages: ?
- Loc: Ozzuland
- Status: Online
- righteous_trespasser
- Scuffle


- Inscription: Mar 12, 2007
- Messages: 6228
- Loc: South-Africa
- Status: Offline
function check_length($max,$string){
if(strlen($string) > $max){
echo "You have passed the maximum amount of characters";
$string = substr($string,0,$max);
}
else{
echo "There are " . $max - strlen($string) . " characters left";
}
}
- function check_length($max,$string){
- if(strlen($string) > $max){
- echo "You have passed the maximum amount of characters";
- $string = substr($string,0,$max);
- }
- else{
- echo "There are " . $max - strlen($string) . " characters left";
- }
- }
Let's leave all our *plum* where it is and go live in the jungle ...
Page 1 sur 1
Pour répondre à ce sujet, vous devez vous connecter ou vous enregistrer. Il est gratuit.
Afficher de l'information
- Total des messages de ce sujet: 2 messages
- Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 263 invités
- Vous ne pouvez pas poster de nouveaux sujets
- Vous ne pouvez pas répondre aux sujets
- Vous ne pouvez pas éditer vos messages
- Vous ne pouvez pas supprimer vos messages
- Vous ne pouvez pas joindre des fichiers