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 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
<html>
<head>
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
else
{
alert("Your browser does not support XMLHTTP.");
}
}
function state_Change()
{
var Chaine;
var debut;
var fin;
var sous;
var O_Dest = document.getElementById( 'T_TXT');
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = "OK"
Chaine=xmlhttp.responseText;
debut = Chaine.indexOf("<tbody>", 0);
fin = Chaine.indexOf("</tbody>", 0);
sous = Chaine.substring(debut+7,fin+8);
var test = sous.replace(/\s/gi," ");
var exp = /((\<td valign='top' >){1}(\w*|(\w*\s*)*)(\<\/td\>){1})/gi;
O_Dest.value = test.match(exp);
}
else
{
alert("Problem retrieving data:" + xmlhttp.statusText);
}
}
}
</script>
</head>
<body>
<textarea id="T_TXT" cols="80" rows="40"></textarea>
<button onclick="loadXMLDoc('http://portail/test.html')">Click</button>
</body>
</html> |
Partager