document.write ne fonctionne pas avec IE !
Coucou,
J'ai simplifié mon problème le plus possible et voici ce qui fonctionne parfaitement avec FF et pas du tout avec IE
test.php comme ceci :
Code:
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
| <head>
<script language="JavaScript">
function toto ()
{
if(document.all){
var xhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;//Internet Explorer
}
else{
var xhrObj = new XMLHttpRequest();//Mozilla
}
//définition de l'endroit d'affichage:
var content = document.getElementById("enr");
xhrObj.open('GET', 'toto.php', true);
xhrObj.send('');
xhrObj.onreadystatechange = function() {
if ( xhrObj.readyState != 4 ) return;
eval(xhrObj.responseText);
};
}
</script>
</head>
<?php
echo "<body>";
echo "<input name='$nom_activer' title='Activer/Désactiver' type='checkbox' value='1' onclick=\"toto();\">";
echo "</body>";
?> |
toto.php
Code:
1 2 3 4 5 6 7 8
| <?php
//echo "document.write (\"<div STYLE='background:#123234;width:200px;height:200px'></div>\");exit;";
echo "document.write(\"<form action='toutou.php' method='post' name='toto' id='toto'>\");";
echo "document.write(\"<input type='text' name='val' value='toto' >\");";
echo "document.write(\"</form>\");";
echo "document.forms.toto.submit();";
//echo "alert ('yep');";
?> |
et enfin toutou.php
Code:
1 2 3 4
| <?php
$val=$_POST['val'];
echo "val = ".$val;
?> |
sous FF j'ai bien par contre sous IE, je pense que document.write est bloquant, je ne parviens pas à comprendre pourquoi !!
Savez-vous pourquoi IE ne fonctionne pas ???