•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,648 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,866 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 839 | Replies: 3
![]() |
Hello everybody,
I wrote a file using AJAX this is the code I wrote:
File.js
I binded that file with a function in javascript:
<script language="javascript">
function GetINF(){
window.setTimeout(getInfo(),1000)
}
</script>
So when this file selects an animated image from the MySQL database it refreshes the image automaticially each 1 second, however I want this image to stay moving until its final frame.
Could you help please?
I wrote a file using AJAX this is the code I wrote:
File.js
var http = createRequestObject();
function createRequestObject(){
var request_;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_ = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
request_ = new XMLHttpRequest();
}
return request_;
}
function getInfo(){
http.open('get', 'GtCht.php');
http.onreadystatechange = handleInfo;
http.send(null);
}
function handleInfo(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('ChtPlc').innerHTML= document.getElementById('ChtPlc').innerHTML + response;
}
}<script language="javascript">
function GetINF(){
window.setTimeout(getInfo(),1000)
}
</script>
So when this file selects an animated image from the MySQL database it refreshes the image automaticially each 1 second, however I want this image to stay moving until its final frame.
Could you help please?
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
•
•
Join Date: Dec 2007
Posts: 75
Reputation:
Rep Power: 1
Solved Threads: 10
My comments are in the code:
var frame=0;
var interval=null;
var http = createRequestObject();
function createRequestObject(){
var request_=null;
//not necessary
//var browser = navigator.appName;
if(window.XMLHttpRequest)
{
request_ = new XMLHttpRequest();
}
else if(window.ActiveXObject){
request_ = new ActiveXObject("Microsoft.XMLHTTP");
}
return request_;
}
function getInfo(){
if( http )
{
//first parameter MUST BE UPPERCASE
http.open('GET', 'GtCht.php');
http.onreadystatechange = handleInfo;
http.send(null);
++frame;
if(frame < 24 )
{
clearInterval(interval);
}
}
else
{
alert("Your browser does not support AJAX.");
}
}
function handleInfo(){
//must make sure you optained the resource successfully
if(http.readyState == 4 && http.status==200){
var response = http.responseText;
document.getElementById('ChtPlc').innerHTML= document.getElementById('ChtPlc').innerHTML + response;
}
}
function GetINF(){
interval = setInterval(getInfo(),1000)
}
Thanks but that does not help...
I want to keep the images (.GIF) moving until it completes.
However my file does not do that...
the page auto-refreshes...
Can you solve it?
I want to keep the images (.GIF) moving until it completes.
However my file does not do that...
the page auto-refreshes...
Can you solve it?
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
Can you link us to a sample page so we can find out what *exactly* are you trying to do?
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
ajax asp cross-browser javascript menu with few lines of code developer development firefox home html internet javascript javascript smooth scrolling scroll smoothly window document position javascript tab menu with rounded corners generator microsoft msdn office prevent javascript menu from getting hidden under flash movies site software sql vista web
- quickly getting from sql (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript breaks IE - please help.
- Next Thread: dhtml justification



Linear Mode