bonjour,
j'ai mon fichier principal dans lequel j'ancre par javascript jquery mon fichier secondaire
fichier principal :
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
|
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
</head>
<body>
<div id="id1"></div>
</body>
</html>
<script >
try {
$(function() {
$("#id1").html("<iframe src = 'http://localhost/b.html' ></iframe>");
var iframeDoc = $("#id1 iframe")[0].contentDocument;
var $iframe = $("#id1 iframe").contents();
var $iFrameContents = $('iframe').contents(),
$entryContent = $iFrameContents.find('html');
alert( $entryContent.html() );
});
}catch(e){
alert(e.message);
}
</script> |
mon fichier secondaire b.html :
1 2 3 4 5 6
|
<html>
<head><title>l'eéfjdkjfkdsjfksdjf pgofpgofpdgopfdg_ç_(_-(è_guifgjifgjkfjg</title></head>
<body>sdsdsdsd sdfhjsdfjsdjfjsdhfjsdjfhsjdfhjsdhfjsdhfjhsdjfhsdjhfjsdhf</body>
</html> |
le problème c'est que
alert( $entryContent.html() );
me renvoie <head></head><body></body> alors que ces balises contiennent de l'info !
Je n'y comprends rien !!!!
Mercid 'avance
Partager