JS = clientside... Weten ze meer van in W&G
Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'
Verwijderd
Geript van www.scottandrew.com:
IE5+, Moz & NS4+ compatible....
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| // readFile
// retrieves the contents of a local file as a JS string.
// NS4 requires Java enabled.
// Works in Mozilla 0.9.5 +
function readFile(url)
{
var req;
if (document.all){
req = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (netscape){
if (document.getElementById){
req = new XMLHttpRequest();
}
else {
req = new NS4HttpRequest();
}
}
req.open("GET",url,false);
req.send(null);
return req.responseText;
}
function NS4HttpRequest()
{
this.url = "";
this.responseText = "";
}
NS4HttpRequest.prototype.open = function(method,url)
{
this.url = url;
this.method = method||get;
}
NS4HttpRequest.prototype.send = function()
{
// thank you Mr. Pemberton
if (this.url=="") return false;
var line,buffer;
this.responseText = "";
buffer = new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(this.url).openStream()));
while ((line = buffer.readLine())!=null) this.responseText+=line + "\n";
if (buffer!=null) buffer.close();
return true;
} |
IE5+, Moz & NS4+ compatible....