Merhaba, öncelikle aşağıdaki gibi bir xml dosyası oluşturup, ismine de deneme.xml adını verin.
<?xml version="1.0" encoding="ISO-8859-9"?>
<document>
<data>
<isim>
<hit>Mustafa KOÇER</hit>
</isim>
</data>
</document>
ardından aşağıdaki şekilde bir html sayfası oluşturun(ismi önemli değil)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>XML</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
<script language="javascript1.2">
var selectedObject;
function result(){
var doc, root, book1, authors, author2,loadreq;
doc = new ActiveXObject("Microsoft.XMLDOM");
doc.async = false;
doc.load("deneme.xml");
if (doc.parseError != 0)
alert(doc.parseError.reason);
else{
root = doc.documentElement;
book1 = root.childNodes.item(0);
authors = book1.getElementsByTagName("isim");
author2 = authors.item(0);
var value=author2.childNodes.item(0);
document.getElementById(selectedObject).value="Merhaba "+value.childNodes.item(0).nodeValue;
}
}
function run(listenObject){
selectedObject=listenObject;
setInterval("result()",500);
}
</script>
</head>
<body onLoad="run('myField')">
<form name="form1" method="post" action="">
<input name="myField" type="text" id="myField" size="10" maxlength="10">
</form>
</body>
</html>
dosyalar
ornek.rar (875,00 bytes)
Umarım size yeni fikirler vermiştir.
Mustafa KOÇER
mkocer@dotnetkosesi.com
1 kişi tarafından 5.0 olarak değerlendirildi
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5