I'm testing an ajax page - this works fine in Firefox:
Click on any of the links on the right under the 'occassions' or 'others' headings, in Firefox, and thumbnails appear based on what you clicked on.
Do the same in IE6, and it returns an error:
Line: 71
Char: 9
Error: Unknown runtime error
This relates to this line:
The error happens as soon as the page is loaded, before I even click a link.
This is the javascript on the page:
The plan was to click a hyperlink on the right, and then send a variable to the 'ajax-ec.asp' page, via this syntax:
Not sure why it would work for Firefox, but not IE6.
I tested on another page:
And this works in IE6, even though the Javascript is v. similar.
But instead of passing the variable as a number as above, the hyperlink is as follows:
And the function initialising the page is:
Where MyPhotoVar is initialised as:
Is that the problem - that I can't send numbers via the functions, but need to use a variable instead?
I'm sorry for:
1. Going on for so long
2. Not knowing what I'm doing
3. Talking a load of rubbish
Thanks
Click on any of the links on the right under the 'occassions' or 'others' headings, in Firefox, and thumbnails appear based on what you clicked on.
Do the same in IE6, and it returns an error:
Line: 71
Char: 9
Error: Unknown runtime error
This relates to this line:
Code:
<p class="ctr"><span id="my_photo_id_label"></span></p>
This is the javascript on the page:
Code:
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
function GetXmlHttpObject() {
var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, Opera...
xmlhttp = new XMLHttpRequest();
//if (xmlhttp.overrideMimeType) xmlhttp.overrideMimeType('text/xml');
} else if (window.ActiveXObject) { // IE
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!xmlhttp) {
alert('Cannot create an XMLHTTP instance');
return false;
}
return xmlhttp;
}
var ec = GetXmlHttpObject();
function sendMyPhotoRequest(id) {
ec.open('get', '../ajax/ajax-ec.asp?id=' + encodeURIComponent(id));
ec.onreadystatechange = handleMyPhotoResponse;
ec.send(null);
}
function handleMyPhotoResponse() {
// If everything is okay:
if(ec.readyState == 4){
// Assign the returned value to the document object.
document.getElementById('my_photo_id_label').innerHTML = ec.responseText;
}
}
addLoadEvent(function() {
sendMyPhotoRequest(44);
})
Code:
<li><a href= "#pop" onclick="sendMyPhotoRequest(45);">Various</a></li>
I tested on another page:
And this works in IE6, even though the Javascript is v. similar.
But instead of passing the variable as a number as above, the hyperlink is as follows:
Code:
<a title="" href="#pc" onclick="sendPhotoRequest(next_photo());">Next</a>
Code:
addLoadEvent(function() {
sendPhotoRequest(MyPhotoVar);
})
Code:
var MyPhotoVar = 0;
I'm sorry for:
1. Going on for so long
2. Not knowing what I'm doing
3. Talking a load of rubbish
Thanks
Comment