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(co de){
http.open('get' , 'appointment_su pport.php?level =2&code='+ code
+'&idone='+ document.regist ration.priority 1.value );
http.onreadysta techange = 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 createRequestOb ject(){
var request_o; //declare the variable to hold the object.
var browser = navigator.appNa me; //find the browser name
if(browser == "Microsoft Internet Explorer"){
request_o = new ActiveXObject(" Microsoft.XMLHT TP");
}else{
request_o = new XMLHttpRequest( );
}
return request_o; //return the object
}
var http = createRequestOb ject();
function getPriority1(co de){
http.open('get' , 'appointment_su pport.php?code= '+ code );
http.onreadysta techange = handlePriority1 ;
http.send(null) ;
}
function handlePriority1 (){
if(http.readySt ate == 4){
var response = http.responseTe xt;
document.getEle mentById('prior ities').innerHT ML = response;
}
}
// UNTIL HERE IT SEEMS TO BE WORKING FINE!!!!
// Get priority 2
function getPriority2(co de){
// alert('shit');
http.open('get' , 'appointment_su pport.php?level =2&code='+ code
+'&idone='+ document.regist ration.priority 1.value );
http.onreadysta techange = handlePriority2 ;
http.send(null) ;
}
function handlePriority2 (){
if(http.readySt ate == 4){
var response = http.responseTe xt;
document.getEle mentById('prior ities').innerHT ML = response;
}
}
// Get priority 3
function getPriority3(co de){
http.open('get' , 'appointment_su pport.php?level =3&code='+ code
+'&idone='+ document.regist ration.priority 1.value +'&idtwo='+
document.regist ration.priority 2.value );
http.onreadysta techange = handlePriority2 ;
http.send(null) ;
}
function handlePriority3 (){
if(http.readySt ate == 4){
var response = http.responseTe xt;
document.getEle mentById('prior ities').innerHT ML = response;
}
} 7 1403
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.c om, 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.javas cript 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="registratio n"> 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="registratio n"> 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.regist ration.priority 1.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="registrat ion"> 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.regist ration.priority 1.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.formNa me.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.javas cript 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.javas cript 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; font-size: 96px; }
<div class="Title">Blahblah</div>
If I change the stylesheet into
|
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: http://www.joshrenaud.com/fredbear/stylesheets/style.css
(both have successfully passed the relevant validators)
The problem is that the Feedback table breaks out of the containing div. I
|
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 specified width inside a
containing div with a specified width seems to break out of that div when
margins are applied to the table.
It seems the table's width defaults to 100% of the parent div. But when I
apply left and right margins to the...
|
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 text of the
menu heading literally sits at the bottom of the cell, so that when
you add the table border, the text looks underlined (this is not the
reason why the text should sit at the bottom, but it is what the end
result should look like.)
|
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?
Thanks!
| |
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 html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML>
<HEAD>
|
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 text in the <td> and style it via the <p>
tag, IE would collapse the table to fit the height of the said text. In
Safari in wont, so there is always unwanted padding in the table. This means
its hard to make neat tables in safari and they end up...
|
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 it will not
work with safari.
function domywindows() {
//alert('test');
mywondows =
window.open('writeme.html','TellAFriend','width=450,height=600');
mywondows.document.write("<html>");
|
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 script blocks. I've made
this example where function def has a local i variable in a loop, and
it calls function abc which also has a local i variable in a loop. What
happens is that Safari is not respecting the scope and is allowing the
called...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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: 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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |