<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>HTTP Get</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
<meta http-equiv="Content-Language" content="pl">
<meta name="Keywords" content="js, javascript, http, method, get">
<meta name="Description" content="Dynamiczne pobieranie zawartości zewnętrznych dokumentów w JavaScript">
<meta name="Author" content="Piechnat">
<script src="http_get.php" type="text/javascript"></script>
<script type="text/javascript">
<!--
hgObj.onrecv = function(str, id, url) {
if (id == 'MY_ID') {
document.getElementById('test_div').innerHTML = str
}
}
hgObj.onerror = function(id, url) {
if (id == 'MY_ID') {
alert('Wystapil blad przy pobieraniu ' + url)
}
}
function loadContent(url) {
hgObj.get(url, 'MY_ID')
}
//-->
</script>
</head>
<body onload="loadContent('info.htm')">
<h1>Dynamiczne pobieranie zawarto¶ci zewnętrznych dokumentów</h1>
<hr>
<p>Wpisz poniżej adres dokumentu i wci¶nij przycisk:</p>
<form onsubmit="return false">
<input type="text" name="txt" size="60">
<input type="button" value="Wczytaj" onclick="loadContent(this.form.txt.value)">
</form>
<hr>
<div id="test_div"></div>
</body>
</html>