Php & javascript
kazem
-
bbar Messages postés 436 Date d'inscription Statut Membre Dernière intervention -
bbar Messages postés 436 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Bonjour,
Quelqu'un peut m'aider resoudre mon probleme liée à lactivation d'un evenement en javascript dans une page PHP.
Voila dans le code suivant j'arrive à capter l'evement
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html lang="en"><head><title>JavaScript - Example form</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
<!--
function checkit()
{
for (i=0;i<2;i++) {
var box = document.forms['example'].elements[i];
if (!box.value) {
alert('Choissiez un ordre SVP ' + box.name + '!');
box.focus()
return;
} else { alert(box.value);
}
}
}
// -->
</script>
<form name="example" action="#" onclick="checkit(); return false">
<table class="form"> <tbody> <tr> <td><select name="refer">
<option value="" selected="selected">--- Select ---</option>
<option value="croise" >croise</option>
<option value="decroise" >decroise</option>
</select> </tbody></table> </form> </body></html>
mais ensuite la meme code dans une page php m'affiche rien.
===== fichier list_user.php
<script type="text/javascript">
<!--
function checkit()
{
for (i=0;i<2;i++) {
var box = document.forms['example'].elements[i];
if (!box.value) {
alert('Choissiez un ordre SVP ' + box.name + '!');
box.focus()
return;
} else { alert(box.value);
}
}
}
// -->
</script>
<?php
$handle = @fopen($IN, "r");
if ($handle)
{
echo "<center>Table d'identification des users Unix</center>";
echo "<table style=text-align: left; border=1 cellpadding=2 cellspacing=2>";
echo " <tbody><tr><td>";
echo "<table style=text-align: left; border=1 cellpadding=2 cellspacing=2>";
echo "<tbody> <tr>";
echo <<< EOF
<td>
<form name="example" action="#" onclick="checkit(); return false">
<select name="refer">
<option value="" selected="selected">--- Tri ---</option>
<option value="croise" >croise</option>
<option value="decroise" >decroise</option>
</select>
</form>
</td>
<td>
<form name="example" action="#" onclick="checkit(); return false">
<select name="refer">
<option value="" selected="selected">--- Tri ---</option>
<option value="croise" >croise</option>
<option value="decroise" >decroise</option>
</select>
</form>
</td>
EOF;
echo "</tr><tr>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">User</td>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">ID</td>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">GID</td>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">Commentaire</td>";
echo "</tr>";
while (!feof($handle))
{
$buffer = fgets($handle, 150);
$pieces = explode(":", $buffer);
echo "<tr>";
echo "<td style=\"background-color: yellow\">$pieces[0]</td>";
echo "<td style=\"background-color: yellow\">$pieces[1]</td>";
echo "<td style=\"background-color: yellow\">$pieces[2]</td>";
echo "<td style=\"background-color: yellow\">";
echo "$pieces[3] $pieces[4] $pieces[5] $pieces[6] $pieces[7]";
echo "</tr>";
}
echo "</tr></tbody></table></td></tr></tbody></table>";
fclose($handle);
}
?>
==============
Merci pour vos aides.
Bonjour,
Quelqu'un peut m'aider resoudre mon probleme liée à lactivation d'un evenement en javascript dans une page PHP.
Voila dans le code suivant j'arrive à capter l'evement
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html lang="en"><head><title>JavaScript - Example form</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
<!--
function checkit()
{
for (i=0;i<2;i++) {
var box = document.forms['example'].elements[i];
if (!box.value) {
alert('Choissiez un ordre SVP ' + box.name + '!');
box.focus()
return;
} else { alert(box.value);
}
}
}
// -->
</script>
<form name="example" action="#" onclick="checkit(); return false">
<table class="form"> <tbody> <tr> <td><select name="refer">
<option value="" selected="selected">--- Select ---</option>
<option value="croise" >croise</option>
<option value="decroise" >decroise</option>
</select> </tbody></table> </form> </body></html>
mais ensuite la meme code dans une page php m'affiche rien.
===== fichier list_user.php
<script type="text/javascript">
<!--
function checkit()
{
for (i=0;i<2;i++) {
var box = document.forms['example'].elements[i];
if (!box.value) {
alert('Choissiez un ordre SVP ' + box.name + '!');
box.focus()
return;
} else { alert(box.value);
}
}
}
// -->
</script>
<?php
$handle = @fopen($IN, "r");
if ($handle)
{
echo "<center>Table d'identification des users Unix</center>";
echo "<table style=text-align: left; border=1 cellpadding=2 cellspacing=2>";
echo " <tbody><tr><td>";
echo "<table style=text-align: left; border=1 cellpadding=2 cellspacing=2>";
echo "<tbody> <tr>";
echo <<< EOF
<td>
<form name="example" action="#" onclick="checkit(); return false">
<select name="refer">
<option value="" selected="selected">--- Tri ---</option>
<option value="croise" >croise</option>
<option value="decroise" >decroise</option>
</select>
</form>
</td>
<td>
<form name="example" action="#" onclick="checkit(); return false">
<select name="refer">
<option value="" selected="selected">--- Tri ---</option>
<option value="croise" >croise</option>
<option value="decroise" >decroise</option>
</select>
</form>
</td>
EOF;
echo "</tr><tr>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">User</td>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">ID</td>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">GID</td>";
echo "<td style=\"background-color: rgb(53, 137, 214);\">Commentaire</td>";
echo "</tr>";
while (!feof($handle))
{
$buffer = fgets($handle, 150);
$pieces = explode(":", $buffer);
echo "<tr>";
echo "<td style=\"background-color: yellow\">$pieces[0]</td>";
echo "<td style=\"background-color: yellow\">$pieces[1]</td>";
echo "<td style=\"background-color: yellow\">$pieces[2]</td>";
echo "<td style=\"background-color: yellow\">";
echo "$pieces[3] $pieces[4] $pieces[5] $pieces[6] $pieces[7]";
echo "</tr>";
}
echo "</tr></tbody></table></td></tr></tbody></table>";
fclose($handle);
}
?>
==============
Merci pour vos aides.
A voir également:
- Php & javascript
- Easy php - Télécharger - Divers Web & Internet
- Telecharger javascript - Télécharger - Langages
- Expert php pinterest - Télécharger - Langages
- A javascript error occurred in the main process - Forum Windows
- A javaScript error occurred in the main process - Forum Handicap / Accessibilté