not sure if you are using any frameworks so this might clash, assum ing you aren't try this -
Code:
<script type="text/javascript">
function goer() {
var url = 'updater.php';
makeHttpRequest(url, thanks);
}
function thanks(text) {
$("ie_rh_ticker").innerHTML=text;
}
function $() {
if (arguments.length == 1) return get$(arguments[0]);
var elements = [];
$c(arguments).each(function(el){
elements.push(get$(el));
});
return elements;
function get$(el){
if (typeof el == 'string') el = document.getElementById(el);
return el;
}
};
function makeHttpRequest(url, callback_function, return_xml)
{
var http_request, response, i;
var activex_ids = [
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'
];
if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE6 and older
for (i = 0; i < activex_ids.length; i++) {
try {
http_request = new ActiveXObject(activex_ids[i]);
} catch (e) {}
}
}
if (!http_request) {
alert('Unfortunately your browser doesnt support this feature.');
return false;
}
http_request.onreadystatechange = function() {
if (http_request.readyState !== 4) {
// not ready yet
return;
}
if (http_request.status !== 200) {
// ready, but not OK
alert('There was a problem with the request.(Code: ' + http_request.status + ')');
return;
}
if (return_xml) {
response = http_request.responseXML;
} else {
response = http_request.responseText;
}
// invoke the callback
callback_function(response);
};
http_request.open('GET', url, true);
http_request.send(null);
}
setInterval(goer(),5000);
</script>
not sure if you are using any frameworks so this might clash, assum ing you aren't try this -
Code:
<script type="text/javascript">
function goer() {
var url = 'updater.php';
makeHttpRequest(url, thanks);
}
function thanks(text) {
$("ie_rh_ticker").innerHTML=text;
}
function $() {
if (arguments.length == 1) return get$(arguments[0]);
var elements = [];
$c(arguments).each(function(el){
elements.push(get$(el));
});
return elements;
function get$(el){
if (typeof el == 'string') el = document.getElementById(el);
return el;
}
};
function makeHttpRequest(url, callback_function, return_xml)
{
var http_request, response, i;
var activex_ids = [
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'
];
if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE6 and older
for (i = 0; i < activex_ids.length; i++) {
try {
http_request = new ActiveXObject(activex_ids[i]);
} catch (e) {}
}
}
if (!http_request) {
alert('Unfortunately your browser doesnt support this feature.');
return false;
}
http_request.onreadystatechange = function() {
if (http_request.readyState !== 4) {
// not ready yet
return;
}
if (http_request.status !== 200) {
// ready, but not OK
alert('There was a problem with the request.(Code: ' + http_request.status + ')');
return;
}
if (return_xml) {
response = http_request.responseXML;
} else {
response = http_request.responseText;
}
// invoke the callback
callback_function(response);
};
http_request.open('GET', url, true);
http_request.send(null);
}
setInterval(goer(),5000);
</script>
Thank you but how can I combine these with my script?
when you do an ajax call in ie, i can't remember but i think ie might be using a cached version of updater.php, 2 fixes possible, either change the 'GET' to a 'POST' if that fails try adding a random variable to the request, the 2 examples below
Hi nomanic,
Using POST got success! Thank you very much...
Unfortunately I don't know any progress bar for ajax.
Also, I want to ask a question to JavaScript experts. I didn't try lots of news bar scipt. And I remember allmost of all tighten/contract in all browsers. Do you know its reason?
When the content of marquecontent is updated, the width of rh_ticker_iedom remains same... Therefore, the script falls in empty (no ticker). How can we update width or marquecontent's character size?
Also, can we start to update marquecontent when the script is first opened?