473,508 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with other browsers than Safari

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;
}
}

Oct 19 '05 #1
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!)

Oct 20 '05 #2
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
Oct 20 '05 #3

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....

Oct 20 '05 #4
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
Oct 21 '05 #5
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
Oct 21 '05 #6
> > (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...)

Oct 22 '05 #7
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
Oct 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6901
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;...
2
4052
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: ...
5
12321
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...
10
2481
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...
1
1280
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? ...
1
1934
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...
6
2155
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...
34
3798
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.
2
2974
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...
8
1658
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...
0
7114
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...
0
7377
jinu1996
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...
1
7034
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...
0
5623
agi2029
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,...
1
5045
isladogs
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...
0
4702
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.