From: foka on

> Please do not remove the attribution lines.
>
>
> PointedEars

So what to do exactly?
How to fix this?

First: How to load XML file correctly?
Second: How to put XML data into <select> options.
Last: How to work with this localy.

I have other sites and there I use XML and DOM method, and everything is
working ok localy in Opera, IE, Chrome, Firefox
but
in this example when I put data to new object (new Option) this is not
working.
Could u write me some correct example.



foka
From: foka on
I found this:

....
for (i=0;i<x.length;i++)
....

here: http://www.w3schools.com/xml/xml_to_html.asp

So why u wrote that this "<" is not correct?
From: Thomas 'PointedEars' Lahn on
foka wrote:

> I found this:
>
> ...
> for (i=0;i<x.length;i++)
> ...
>
> here: http://www.w3schools.com/xml/xml_to_html.asp

AISB, you don't want to use w3schools.com as reference.
(Hint: w3schools.com has nothing to do with w3.org).

> So why u wrote that this "<" is not correct?

Because you have an XHTML document. Learn to read (and to post).


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
From: CrazySeal on
I modyfied my code a little and on server is working but on local
(without apache) my <select> is empty:

My code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8"/>
<title>Some</title>
<link rel="stylesheet" type="text/css" href="css/print.css"
media="screen" />
<script type="text/javascript">
function getXMLHttpRequest() {
var request = false;
try {
request = new XMLHttpRequest();
} catch(err1) {
try {
request = new ActiveXObject('Msxml2.XMLHTTP');
} catch(err2) {
try {
request = new
ActiveXObject('Microsoft.XMLHTTP');
} catch(err3) {
request = false;
}
}
}
return request;
}
function showGroups() {
var x = r.responseXML.getElementsByTagName("group");
for (var i=0; i < x.length; i++) {
document.forms['searchForm'].groups.options[i] =
new Option(x[i].firstChild.nodeValue,x[i].firstChild.nodeValue);
}
}
</script>
</head>
<body>
<div id="content">
<form id="searchForm" action="" method="get"
onSubmit="">
<select name="groups" class="groups">
</select>
<input class="submit" type="submit"
value="Szukaj" />

</form>
</div>
</body>
</html>
<script type="text/javascript">
var r;
r = getXMLHttpRequest();
r.open('GET', '../xml/groups.xml', true);
r.onreadystatechange = showGroups;
r.send(null);
</script>

XML file:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<group>AK</group>
<name>Some Ak</name>
</item>
<item>
<group>BZ</group>
<name>Some BZ</name>
</item>
</items>

Could somebody help me? what to change to run this site without
apache.

Foka
From: VK on
On Apr 23, 12:00 am, CrazySeal <mariusz.barty...(a)gmail.com> wrote:
> Could somebody help me? what to change to run this site without
> apache.

You question is already answered in my last post. Simply replace
var x = r.responseXML.getElementsByTagName("group");
to
window.alert(r.responseText)
to see it.


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: Quicktime and innerHTML
Next: option & textnode