Hi,
So far I wrote a few little things in javascript, but I got a small
problem with the following code. Apperently, only Apple's Safari is
handling the following code correctly. I took it from a webpage, and
modified it a bit (just the request line). I might have made some basic
mistake there.
My questions is especially concerning th following piece of code. There
seems to be a problem in the line with http.open(). At least if I put
an alert() message before it it pops-up, after it it does not show.
function getPriority2(code){
http.open('get', 'appointment_support.php?level=2&code='+ code
+'&idone='+ document.registration.priority1.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
Is there anybody who has an idea about how make it working in all
browsers? Below you find my whole javascript code. It refers to a php
page (from which I know it is working correctly - got a lot more
experience there than with javascript).
I would highly appriciate any help!
Thanks in advance!!!!
Regards,
Jochem
------------------
My code
------------------
function createRequestObject(){
var request_o; //declare the variable to hold the object.
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_o = new XMLHttpRequest();
}
return request_o; //return the object
}
var http = createRequestObject();
function getPriority1(code){
http.open('get', 'appointment_support.php?code='+ code );
http.onreadystatechange = handlePriority1;
http.send(null);
}
function handlePriority1(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
// UNTIL HERE IT SEEMS TO BE WORKING FINE!!!!
// Get priority 2
function getPriority2(code){
// alert('shit');
http.open('get', 'appointment_support.php?level=2&code='+ code
+'&idone='+ document.registration.priority1.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
function handlePriority2(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
// Get priority 3
function getPriority3(code){
http.open('get', 'appointment_support.php?level=3&code='+ code
+'&idone='+ document.registration.priority1.value +'&idtwo='+
document.registration.priority2.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
function handlePriority3(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
} 7 1389
you need to pass a third variable in your http.open call, true, that
tells to connect asynchronously. i think that should solve the problem,
if not, post a reply.
You may also want to try the code at http://jibbering.com/2002/4/httprequest.html , which handles the two
different IE interfaces to ajax used by different versions of IE.
(Microsoft can't even adhere to their own standards!)
Joshie Surber said the following on 10/19/2005 9:34 PM:
Please quote what you are replying to.
If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers. you need to pass a third variable in your http.open call, true, that tells to connect asynchronously. i think that should solve the problem, if not, post a reply.
You may also want to try the code at http://jibbering.com/2002/4/httprequest.html , which handles the two different IE interfaces to ajax used by different versions of IE.
It also covers a lot more than that....
(Microsoft can't even adhere to their own standards!)
I love this anti-MS shit. MS sticks to the same method, people complain
about it using old technology. They update and people complain about MS
not adhering to their own standards.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Joshie Surber wrote: you need to pass a third variable in your http.open call, true, that tells to connect asynchronously. i think that should solve the problem, if not, post a reply.
You may also want to try the code at http://jibbering.com/2002/4/httprequest.html , which handles the two different IE interfaces to ajax used by different versions of IE. (Microsoft can't even adhere to their own standards!)
Apprently, my javascript code was correct, but I made a basic mistake
in my HTML form. For Safari 2.0 it is sufficient that a <form
id="registration"> However, any other browser needs a name="'. Can't
blame them for that. I might wanna sleep a bit more....
Jochem Donkers wrote: Apprently, my javascript code was correct, but I made a basic mistake in my HTML form. For Safari 2.0 it is sufficient that a <form id="registration"> However, any other browser needs a name="'.
That's just not true. One can access `form' element objects by ID within
the `document.forms' collection in Mozilla Firefox, for example. That is
because the `name' attribute is not #REQUIRED for `form' elements in Valid
HTML 4/XHTML 1.x.
Your problem is instead that you are using proprietary referencing which
is likely to differ in support between user agents. Instead of
document.registration.priority1.value
use the standardized
document.forms['registration'].elements['priority1'].value
and everything should work smoothly even without `name' attributes.
Can't blame them for that.
Indeed. Although widely implemented, there has never been a public
specification on DOM Level 0, one has only the Netscape JavaScript
Reference and MSDN Library at hand for most features.
I might wanna sleep a bit more....
And you might want to validate your documents before complaining.
An `action' attribute value (even if empty) is missing for the
`form' element, too.
You also want to drop that "browser detection" nonsense, see for
example <http://pointedears.de/scripts/test/whatami>.
PointedEars
Thomas 'PointedEars' Lahn said the following on 10/21/2005 3:07 PM: Jochem Donkers wrote:
Apprently, my javascript code was correct, but I made a basic mistake in my HTML form. For Safari 2.0 it is sufficient that a <form id="registration"> However, any other browser needs a name="'.
That's just not true. One can access `form' element objects by ID within the `document.forms' collection in Mozilla Firefox, for example. That is because the `name' attribute is not #REQUIRED for `form' elements in Valid HTML 4/XHTML 1.x.
Your problem is instead that you are using proprietary referencing which is likely to differ in support between user agents. Instead of
document.registration.priority1.value
use the standardized
document.forms['registration'].elements['priority1'].value
and everything should work smoothly even without `name' attributes.
Can you name a browser where
document.formName.elementName.property
doesn't work but
document.forms['formName'].elements['elementName'].property
does work?
Except in the case where the formName or elementName contain spaces, []
or other undesirable characters?
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
> > (Microsoft can't even adhere to their own standards!) I love this anti-MS shit. MS sticks to the same method, people complain about it using old technology. They update and people complain about MS not adhering to their own standards.
And I wouldn't complain about it if they updated so they were
compatable with a standard or another browser or the such, but all they
did was switch from one proprietary Active X component to another. This
is hardly progress on their part... two "standards" of Active X from
Micro$oft while every other browser uses the exact same XMLHttpRequest
object.
(At least I hear this will exist in IE7... I guess they're trying and I
do have to give them credit for that...)
Joshie Surber said the following on 10/22/2005 7:17 AM: (Microsoft can't even adhere to their own standards!) I love this anti-MS shit. MS sticks to the same method, people complain about it using old technology. They update and people complain about MS not adhering to their own standards.
And I wouldn't complain about it if they updated so they were compatable with a standard or another browser or the such, but all they did was switch from one proprietary Active X component to another.
And the new one seems to be better than the old one. And no, MS will
never get away from ActiveX.
This is hardly progress on their part... two "standards" of Active X from Micro$oft while every other browser uses the exact same XMLHttpRequest object.
No, they all use there own implementation of a native XMLHTTPRequest
object. And not "every other browser" implements it.
(At least I hear this will exist in IE7... I guess they're trying and I do have to give them credit for that...)
That will have to wait until IE7 is finally released.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: London Geek |
last post by:
Hello,
I'm having a rendering problem with italics in Safari 1.2. The
following displays correctly and is consistent with other Mac and
non-Mac browsers:
..Title { font-family: Impact;...
|
by: Josh Renaud |
last post by:
I'm working on a site and ran into a little trouble with Safari.
Here are the relevant links:
page: http://www.joshrenaud.com/fredbear/contact.html
css: ...
|
by: Josh Renaud |
last post by:
I'm still trying to solve a problem I have experienced in Safari. This is my
third post on the subject. I'm hoping someone can shed some light.
The problem is that, in Safari, a table with no...
|
by: Lorenzo Gordon |
last post by:
Hi all,
I've trawled the archives in vain for a similar problem:
In building a client's site, I've got a menu section where each menu
heading sits in a table cell. It's _paramount_ that the...
|
by: Jane Hawkins |
last post by:
My asp.net-created page looks fine for most browsers, but on Safari the text
assigned to a label at the end of my file displays over the top of the
beginning text.
Any idea how I can fix this?
...
| |
by: gerry |
last post by:
Hi, although this is not strictly asp.net related, I was hoping that someone
could confirm or debunk what appears to be a major problem with safari
POSTs.
with the following html :
<!DOCTYPE...
|
by: Tim Rogers |
last post by:
Hi!
how do I get around the problem of safari failing to fit a table row to the
size of the text based content in the same was as IE does? For example if I
were to create a 5 row table add...
|
by: Simon Wigzell |
last post by:
document...focus() will scroll the form to move the
specified text field into view on everything I have tried it with except
Safari on the MAC. The form doesn't move. Any work around? Thanks.
|
by: darren |
last post by:
I have a small Javascript problem with that mutch love web browser
safari, I tested the code on all other browsers PC (Win) and Linux and
IE on the mac and it seams to work ok, but for some reason...
|
by: dd |
last post by:
Hi,
I've discovered a scenario where Safari 1.3 (I need to make my stuff
compliant with 1.3+) gets confused about the scope of local variables
WITHIN functions that were created in dynamic...
|
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...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
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.
| |