I'm trying to develop a way to include static files in htm pages with
javascript.
I'm trying to use XMLHTTP object this way:
----------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>XMLHTT P</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" );
} catch (e) {
try {
xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest! ='undefined') {
xmlhttp = new XMLHttpRequest( );
}
function include(xUrl,xI d){
xmlhttp.open("G ET", xUrl,true);
xmlhttp.onready statechange=fun ction() {
if (xmlhttp.readyS tate==4) {
document.getEle mentById(xId).i nnerHTML = xmlhttp.respons eText;
}
}
xmlhttp.send(nu ll)
}
</script>
</head>
<body>
<script type="text/javascript">
include("header .htm", "xheader");
</script>
<div id="xheader"></div>
<hr>Corpo<hr>
<div id="xfooter"></div>
<script type="text/javascript">
include("footer .htm", "xfooter");
</script>
</body>
</html>
----------------------------------------------------------------------
header.htm and footer.htm are html examples files.
It doesn't work if I call header and footer but if I call only header it
works.
Any help much appreciated.
Best Regards.
--
Fabri
(Non è tuttu oru chiddu chi stralluci, né tuttu veru chiddu ca si dici) 7 2504
Fabri wrote: I'm trying to develop a way to include static files in htm pages with javascript.
I'm trying to use XMLHTTP object this way:
----------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>XMLHTT P</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript">
var xmlhttp=false;
try { xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" ); } catch (e) { try { xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP"); } catch (E) { xmlhttp = false; } }
if (!xmlhttp && typeof XMLHttpRequest! ='undefined') { xmlhttp = new XMLHttpRequest( ); }
function include(xUrl,xI d){ xmlhttp.open("G ET", xUrl,true); xmlhttp.onready statechange=fun ction() { if (xmlhttp.readyS tate==4) { document.getEle mentById(xId).i nnerHTML = xmlhttp.respons eText; } } xmlhttp.send(nu ll) }
</script> </head> <body> <script type="text/javascript"> include("header .htm", "xheader"); </script> <div id="xheader"></div> <hr>Corpo<hr> <div id="xfooter"></div> <script type="text/javascript"> include("footer .htm", "xfooter"); </script> </body> </html>
----------------------------------------------------------------------
header.htm and footer.htm are html examples files.
It doesn't work if I call header and footer but if I call only header it works.
Any help much appreciated.
Best Regards.
why not simply use Server Side Include, or the php equivalent ?
Martin! wrote: why not simply use Server Side Include, or the php equivalent ?
Because on my hosting-server they are not supported.
--
Fabri
(Non è tuttu oru chiddu chi stralluci, né tuttu veru chiddu ca si dici)
Bonjour à Fabri <no@sp.am> qui nous a écrit : [...] function include(xUrl,xI d){ xmlhttp.open("G ET", xUrl,true); xmlhttp.onready statechange=fun ction() { if (xmlhttp.readyS tate==4) { document.getEle mentById(xId).i nnerHTML = xmlhttp.respons eText; } } xmlhttp.send(nu ll) }
</script> </head> <body> <script type="text/javascript"> include("header .htm", "xheader"); </script> <div id="xheader"></div> <hr>Corpo<hr> <div id="xfooter"></div> <script type="text/javascript"> include("footer .htm", "xfooter"); </script> </body> </html> [...]
be carefull, you must place "div" tag before the script, ie :
...
<div id="xheader"></div>
<script type="text/javascript">
include("header .htm", "xheader");
</script>
...
--
Cordialement, Thierry ;-)
Fabri wrote: Martin! wrote: why not simply use Server Side Include, or the php equivalent ?
Because on my hosting-server they are not supported.
Then you should switch ASAP to another service provider or wait for, hm,
another year to get XMLHTTPRequest widely implemented. And then it is
likely that you have a Web where exploits let emerge UAs where this single
feature, short of disabling client-side scripting completely or not even
have it supported in the first place, can be disabled. Fortunately,
hosting prices would have dropped by then as well.
BTW: Your sender address is forged which violates/disregards Internet
standards, most certainly the Acceptable Use Policy of your Usenet access
provider (NGI S.p.A.) and Netiquette. Change this ASAP or prepare to face
the consequences.
PointedEars
--
Der Beweis ist ein Götze, vor dem der Mathematiker sich foltert.
-- Sir Arthur Stanley Eddington (1882-1944)
Thomas 'PointedEars' Lahn wrote: Fabri wrote:
Martin! wrote:
why not simply use Server Side Include, or the php equivalent ? Because on my hosting-server they are not supported.
Then you should switch ASAP to another service provider or wait for, hm, another year to get XMLHTTPRequest widely implemented.
It is supported in perhaps 90% of browsers on the web, how much more
"widely" do you want it implemented?
<snip>
BTW: Your sender address is forged which violates/disregards Internet standards, most certainly the Acceptable Use Policy of your Usenet access provider (NGI S.p.A.) and Netiquette. Change this ASAP or prepare to face the consequences.
Please tell me we are not going to go through this childish juvenile
bullshit again about email addresses?
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
You could also consider using iframes. They have their own set of
issues, but they are simple to implement.
In article <2L************ ********@comcas t.com>, Hi************@ aol.com
enlightened us with... Please tell me we are not going to go through this childish juvenile bullshit again about email addresses?
His childish bullshit about email addresses and attributions is why he's one
of only two people in my killfile. He spends more time going on about what
other people did wrong in their postings than any other topic. It negates the
useful stuff he posts.
Some people need to learn that they aren't the 'net police. Until they do, I
don't need to take up my valuable time reading their crap.
/ wishes there was a way to kill responses to this shit without killfiling
the people relying...
--
--
~kaeli~
If a turtle doesn't have a shell, is he homeless or naked? http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Waller |
last post by:
Hello,
I'm using the MSXML.XMLHTTP object to obtain the results of an ASP page from
an ASP page on the same server. The problem I have is that when the AP
refrenced by the XMLHTTP object is run it does now share the session with
the calling page ? How can I solve this ?
Any ideas ?
Many thanks...
|
by: Krzysztof Kubiak |
last post by:
I'm trying to make use of XMLHTTP object, but I've come across a
problem.
It seems that there is no way to create dynamic array of such XMLHTTP
objects (to make several requests) and handle them properly.
I was trying to use such code:
<script lang="javascript">
function handleOnReadyStateChange() {
if (this.readyState==4) {
|
by: kajol |
last post by:
Hi everyone
I am trying to get the content of any webpage (URL) using XMLHTTP, and it
is working fine for me, but suddenly I have got
a URL "http://www.bizrate.com/" which is causing a system error and the
error is
System.Runtime.InteropServices.COMException(0xC00CE56E): System error:-
1072896658
|
by: bboyle18 |
last post by:
Hi,
I've been looking into the possibility of using XMLHTTP for my
enterprise application but I still have a question.
When you send the request to the server, how does the server know how
to handle the request? (i.e. how do I specify what method to call in my
java servlet?)
I'd appreciate any help on this.....I've only got a vaey basic
|
by: Kapil Shah |
last post by:
Hello everybody,
I am trying to develop code to use the correct version of XMLHTTP before
using it to send SOAP envelope to WebService . The code I have written
is as follows,
function getWebServiceResultsAfterInit() {
// Must be using IE for this to work
if(window.ActiveXObject){
// Create the XML Document object
| |
by: Dave H |
last post by:
First..
What object (on the client) should I be using these days?
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
or
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
or maybe something different?
|
by: daninbrum |
last post by:
Dear All,
Please excuse the following thickness, I am new to client scripting.
I have set up a page comprising of three DIVs, the content of which
gets changed by XMLHTTP requests (including the following code in a
function).
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
document.getElementById(loc).innerHTML = xmlhttp.responseText;
|
by: Andrea Cogliati |
last post by:
I'm accessing a Web Service through XMLHttp object from a JavaScript client
code. I don't understand how to appropriately handle exceptions from the Web
Service.
Does anyone have a piece of code of a Web Service throwing an exception and
a client code catching it?
TIA,
Andrea
|
by: mirandacascade |
last post by:
I recognize that this question is not about javascript per se...it is
more about xmlhttp...posting the question at this site because it
appears as though this site has many posts related to xmlhttp
Situation is this:
1) making use of the COM object MSXML2.XMLHTTP in a client application
2) I use the open() method of the COM object and specify a "POST", then
I use the send() method of the COM object
3) when the url is an http url, able...
|
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: 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: 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: 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...
| |