lesmith
04-06-2006, 11:40 PM
Hello Peeps.
Sorry if this is basic stuff but I am waiting for my Book to arive and tring to do a little bit before it arrives.
I have a simple script to collect some php data (Just some Text) and display in div on mouseover.
All works fine apart from if I update the data (In other words add more text). The update happens correctly in Firefox but Not in IE.
Here is the simple script.
Hopefully some one can give me some pinters.
<script type="text/javascript">
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}
</script>
And the HTML.
<a href="#" onmouseover="getData('/includes/data.php?event=showuser', 'targetDiv')">Show Users</a> | <a href="#" onmouseover="getData('/includes/data.php?event=showblog', 'targetDiv')">Show Latest Blog</a>
<div id="targetDiv"></div>
I guess this has something to do with the DOM and ie.
Hope you can shed some light.
Regards & Thanks
Sorry if this is basic stuff but I am waiting for my Book to arive and tring to do a little bit before it arrives.
I have a simple script to collect some php data (Just some Text) and display in div on mouseover.
All works fine apart from if I update the data (In other words add more text). The update happens correctly in Firefox but Not in IE.
Here is the simple script.
Hopefully some one can give me some pinters.
<script type="text/javascript">
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}
</script>
And the HTML.
<a href="#" onmouseover="getData('/includes/data.php?event=showuser', 'targetDiv')">Show Users</a> | <a href="#" onmouseover="getData('/includes/data.php?event=showblog', 'targetDiv')">Show Latest Blog</a>
<div id="targetDiv"></div>
I guess this has something to do with the DOM and ie.
Hope you can shed some light.
Regards & Thanks