Thomas 'PointedEars' Lahn said:
The form might not need a name or an ID.
<label for="select">Year</label>
<div id='Yr'> </div>
<label for="select">Month</label>
<div id='Mo'> </div>
<label for="select">Day</label>
<div id='Da'> </div>
</form>
</body>
Only the last call in LoadList() is in the web page when it is
displayed.
I can make one of the other calls the last call and it will be
displayed.
The Select???.htm's contain <select><option> html.
Im pretty sure the error is in line 7.
[...]
Please trim your quotes to the necessary minimum.
[...] Line 7 is the standard comment end for JavaScript.
Nonsense. It is a CDC (Comment Declaration Close) delimiter hidden from
the
JS engine as a single-line comment; a practice that, from the standards
perspective, has always been obsolete (HTML 3.2 introduced the `script'
element, a UA is FUBAR if it renders its content).
The point I think Georg was trying to make, though, is that your script
code
is syntactically valid, and without knowing about makerequest() there is
no
telling where it might otherwise go wrong.
On your suggestion, I took the comment out. Didn't change anything?
It might have, especially with XHTML, which would then not be well-formed.
Here is the makerequest function. It's right out of the book,
"Beginning Ajax with PHP." It seems to work in all the book examples.
function makerequest(serverPage, objID) {
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
What is `xmlhttp'?
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Is this running via HTTP(S) on a Web server? Otherwise status can be 0.
obj.innerHTML = xmlhttp.responseText;
Possibility: The space-containing `div' elements are considered empty and
thus can be non-existent at the mercy of the DOM implementation.
That said, with (server-side) PHP you probably don't need all that but you
can (and should) include the form controls in the first place.
<
http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1DontWork>
<
http://www.jibbering.com/faq/#debugging>
PointedEars
Okay... My snippet was to "LITTLE." Here is all the Javascript and HTML for
the page...
<script type="text/javascript">
//Create a boolean variable to check for a valid Internet Explorer
instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
// alert("You are using Microsoft IE");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using MS.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
// alert("You are using Microsoft IE");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the
object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
// alert("You are not using Microsoft IE");
}
/*
var xmlhttp;
//If, the activexobject is available, we must be using IE.
if (window.ActiveXObject){
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} else {
//Else, we can use the native Javascript handler.
xmlhttp = new XMLHttpRequest();
}
*/
function makerequest(serverPage, objID) {
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}
function LoadLists() {
makerequest('SelectDay.htm','Da');
makerequest('SelectYear.htm','Yr');
makerequest('SelectMonth.htm','Mo');
}
</script>
</head>
<body onload="LoadLists()">
<form name="form1" id="form1" method="post" action="">
<label for="select1">Year<div id='Yr'></div></label>
<label for="select2">Month<div id='Mo'></div></label>
<label for="select3">Day<div id='Da'></div></label>
</form>
</body>