Because Firefox and IE render web pages differently, I cant get the same results.
I working with many embedded tables that contain javascript functionality inside.
What I have is a table that contains radio buttons. Once the user selects a button, I use the onClick functionality to generate 2 dynamic selectors that are inserted once results come back from DataBase.
I want to display a simple message (Query in progress) until the selectors are generated (2sec). To display the message:
document.getEle mentById('waitQ uery').style.di splay='';
and once the selectors are build remove message:
document.getEle mentById('waitQ uery').style.di splay='';
This works in Firefox, but not in IE. Why, because the table is not complete, that is the selectors are not done yet. So IE does not show the message either. Once the selectors are created, IE executes the Javascript, but so fast that message is not seen, plus in does not make sense to show the message after the wait time passed.
Please, help... I just want a simple message to be Displayed in IE while query in progress...
May 12 '09
25 4691
Gits,
I will be back at work on Monday and will apply new changes to the code then. I will post the new results then.
Thanks for your time.
Tusovka
gits 5,390
Recognized Expert Moderator Expert
no problem :) ... i'll have a look at it then :) ... have a nice weekend ...
kind regards,
gits
Gits,
Well I modified the code as you mention in the previous post. -
-
oRequest.open(\"GET\",sURL,true); //used to be false !!!
-
oRequest.setRequestHeader(\"User-Agent\",navigator.userAgent);
-
oRequest.send(null)
-
-
oRequest.onreadystatechange = function() {
-
if( oRequest.readyState == 4 ) {
-
//response is ok
-
if( oRequest.status == 200 ) {
-
//alert( oRequest.responseText );
-
return(oRequest.responseText);
-
} else {
-
alert(\"Error executing XMLHttpRequest call!\");
-
}
-
}
-
}
-
-
Well I know the last alert never executes so that good news. Unfotunatly, both FireFox and IE both behave the same now. The output is: instantaneous population of the <span> container with a message ( undefined ) instead of a selector.
Please note I inserted the return( ) myself because if was not mentioned where that line of code should go.
Gits,
As I was examining the ( https://developer.mozilla.org/En/Using_XMLHttpRequest) web page you recommended I found a few varibles I though might me effecting my program.
In the online example: - var req = new XMLHttpRequest();
-
req.open('GET', 'http://www.mozilla.org/', true);
-
req.onreadystatechange = function (aEvt) {
-
if (req.readyState == 4) {
-
if(req.status == 200)
-
dump(req.responseText);
-
else
-
dump("Error loading page\n");
-
}
-
};
-
req.send(null);
note the function takes a variable!, mine does not? also the (;) at the end of the function definition. I tried adding the (;) still same behavior. Also the use of dump() instead of return. Finally the send(Null) is at the end of all of this.
I'm not sure why the difference, but thought I should mention what I have noticed.
My pevious post is not posted yet, (Waiting to be approved).
acoder 16,027
Recognized Expert Moderator MVP
The function doesn't need a parameter and the semi-colon is not required.
Move the send to the end. dump() is a user defined function. Your return isn't quite correct, because what does it return to. I would suggest that you change your code where you have: - var techinfo=techPage(A, B, C, D);
-
document.getElementById('tech_selector').innerHTML=techinfo;
and change that to use the response to set the tech selector, e.g. - document.getElementById('tech_selector').innerHTML=oRequest.responseText;
in place of the return.
I would like to thank everyone who gave advice and made it possible for me to figure out this task. Finally, I got the query message to display in both FF and IE.
First, something that is not seen here is a small php code that goes in to my tech.php page. Right after I decipher the URL and pull out the needed variables, the next thing i do is a ---> flush(); <---.
Now, going back to my JavaScript function : techPage()
1) Note, I'm using the code snippet (Git's) recommended a couple of post above. -->oRequest.statu s == 200 and the readyState == 4....
2) I implemented the idea (Acoder) recommended and got rid of the return, and actually loaded the span right here instead of later in my code. But, just to make a note the return worked, how I'm not sure. I still made the change just because it made my code simpler to understand (I think).
3) Note that im actually turning on and off the message here instead of another embedded location.
4) Finally the readyState ==2 was the trick that made it all work.
So it works... Thanks for all your help... -
-
function*techPage(A, B, C, D, E, F)*{
-
var*oRequest*=*new*XMLHttpRequest();
-
var*sURL=*\"http://\"+self.location.hostname+E+D+\".php?A=\"+A+\"&B=\"+B+\"&F=\"+F;
-
//alert(sURL);
-
//document.write(sURL);
-
oRequest.open(\"GET\",sURL,true);
-
oRequest.setRequestHeader(\"User-Agent\",navigator.userAgent);
-
oRequest.send(null) ;
-
-
oRequest.onreadystatechange = function() {
-
if( oRequest.readyState == 4 ) { //transaction is complete (4)
-
document.getElementById('wait_message').style.display='none'; //message OFF
-
if( oRequest.status == 200 ) { //HTTP statues OK
-
document.getElementById('tech_selector').inner HTML=oRequest.responseText;
-
} else {
-
alert(\"Error executing XMLHttpRequest call!\");
-
}
-
}
-
if( oRequest.readyState == 2 ) { //loaded = 2
-
document.getElementById('wait_message').style.display='';
-
//during this state display the message (ON)
-
}
-
} //end of function()
-
} //end of techPage()
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: lawrence |
last post by:
This page renders slowly on both IE and Netscape - everything
downloads before anything appears on screen. It is the behavior you'd
expect if the whole thing was wrapped in a table, yet there is no
table. What other sorts of problems normally cause this?
|
by: Rick Spiewak |
last post by:
I need to generate a "buy" button as part of an ASP.NET page - this consists
of a small HTML form with hidden fields, conforming to the requirements of a
merchant credit card processor. PayPal is similar.
I'm succeeding in doing this by using Writer.Write to emit my HTML, at least
as far as getting it to work.
However, depending on where I put MyBase.Render(Writer), I get my HTML
either before the header or after the end of the body of...
|
by: Bill Hauver |
last post by:
I am attempting to display a web page which simple
displays a 'Please wait, generating report...' message
before I redirect a user to another web page. I can't
figure out where to put the redirect code because
the 'please wait' page doesn't render to the client
browser (the message is never displayed before the
redirect). Any suggestions would be most helpful!
Thanks - Bill
|
by: John Lau |
last post by:
Hi,
Is there documentation that talks about the page lifecycle, the lifecycle of
controls on the page, and the rendering of inline code, in a single
document?
Thanks,
John
|
by: Nathan Sokalski |
last post by:
One thing that I have often needed to do that I have been unable to find a
way to do is refresh the page (basically do the same thing as pressing the
browser's Refresh button). I know how to do this using Javascript/JScript,
but I have situations in which I need it to be done immediately after code
that is part of my other code. Is there any way to do this? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
| |
by: Brent |
last post by:
Like many sites, mine has a standard "look" -- a template, if you will
-- that visitors see on each page. I've tried to keep the code and HTML
separate to the extent possible, and for most standard page
presentations, it works well.
However, I have a couple of screen scrape / import routines that can
take minutes, even hours, to complete. I'd like to have some way of
outputting my template first to the browser, and then within the...
|
by: Ambush |
last post by:
My aspx is called from an ASP page. I process the request and then
call another ASP page with a few hidden inputs. Currently, when the
page processes, the user is complaining that my code is running too
fast and that my "Please Wait" page flashes by too quickly. I can't
put an inline wait/sleep command, as the page doesn't refresh until the
code is done running. I've tried using a:
<meta id="mtaRefresh" http-equiv="refresh"...
|
by: Crirus |
last post by:
I made a simple test... loaded an image from file and draw it on a form
In mouse move, I just refresh the form.... that cause 1 000 000 page faults
(as task manager shows) in less than a minute.. what is that?
--
Ceers,
Crirus
------------------------------
If work were a good thing, the boss would take it all from you
|
by: lmttag |
last post by:
Hello.
We're developing an ASP.NET 2.0 (C#) application and we're trying to
AJAX-enable it. We're having problem with a page not showing the page while
a long-running process is executing. So, we're looking for a way to display
the page with a "please wait..." message while the process is running, and
then, when the process is done, update the page with the actual results/page
content.
We have a page that opens another browser/page...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |