wat doe ik fout ?
en wie weet hoe ik <pubDate>Mon, 06 Dec 2004 05:40:05 GMT</pubDate>
met javascript kan omzetten naar 6-12-2004 17:40 uur
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>test pagina</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
var useMozilla = true;
var refreshInterval = 600;
var refreshTimeout = 10;
var headlineXML =
'http://news.search.yahoo.com/news/rss?p=ASML&_adv_prop=web&ei=UTF-8&prev_vm=p&vst=0&vm=p&fl=0&n=10&datesort=1.xml';
//var newsURL = '';
var numHeadlines = 6;
function init() {
//var bgcol = location.search.substring(1);
//if (!bgcol) bgcol = '#243462';
//document.body.style.backgroundColor = bgcol;
loadheadlines();
}
var xmlDoc = null;
var refreshTimer = 0;
function loadheadlines() {
xmlDoc = XmlDocument.create();
xmlDoc.async = true;
if (window.netscape) window.netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
xmlDoc.load(headlineXML+'?'+new Date().valueOf());
refreshTimer = 0;
setTimeout('loading()', 500);
}
function loading() {
var parseerror = false;
if ((xmlDoc.readyState == 'complete' || xmlDoc.readyState == 4) && !xmlDoc.getElementsByTagName('item').item(0)) {
parseerror = true;
} else if (xmlDoc.parseError) {
if (xmlDoc.parseError.reason != '') parseerror = true;
}
if (!parseerror && refreshTimer < refreshTimeout) {
if (xmlDoc.readyState != 'complete' && xmlDoc.readyState != 4) {
refreshTimer += 0.5;
setTimeout('loading()', 500);
} else {
setTimeout('showheadlines()', 100);
}
} else {
xmlDoc = null;
setTimeout('loadnext()', 2000);
}
}
function loadnext() {
refreshTimer = refreshInterval;
refreshing();
}
function refreshing() {
refreshTimer--;
if (refreshTimer <= 0) {
setTimeout('loadheadlines()', 100);
} else {
setTimeout('refreshing()', 1000);
}
}
var n;
var t;
var tot;
var headlineHTML;
function showheadlines() {
n = 0;
t = 0;
tot = xmlDoc.getElementsByTagName('item').length;
headlineHTML = '';
parseXML();
}
function parseXML() {
//var id = xmlDoc.getElementsByTagName('id').item(n).childNodes.item(0).nodeValue;
var title = xmlDoc.getElementsByTagName('title').item(n).childNodes.item(0).nodeValue;
//var time = xmlDoc.getElementsByTagName('time').item(n).childNodes.item(0).nodeValue;
n++;
title = title.replace(/</g, '<');
title = title.replace(/>/g, '>');
headlineHTML+= time+' - <a class=qw href="'+newsURL+id+'.htm">'+title+'</a><br>';
t++;
if (t == numHeadlines || n == tot) {
document.getElementById('headlines').innerHTML = headlineHTML;
xmlDoc = null;
loadnext();
} else {
setTimeout('parseXML()', 10);
}
}
function openlink(url) {
if (document.all && useMozilla) VBopenLink(url);
else window.open(url, '', '');
}
///////////// deel 2
function getDomDocumentPrefix() {
if (getDomDocumentPrefix.prefix) return getDomDocumentPrefix.prefix;
var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
var o;
for (var i = 0; i < prefixes.length; i++) {
try {
// try to create the objects
o = new ActiveXObject(prefixes[i] + ".DomDocument");
return getDomDocumentPrefix.prefix = prefixes[i];
}
catch (ex) {};
}
throw new Error("Could not find an installed XML parser");
}
// XmlDocument create
function XmlDocument() {}
XmlDocument.create = function () {
try {
// DOM2
if (document.implementation && document.implementation.createDocument) {
var doc = document.implementation.createDocument("", "", null);
// some versions of Moz do not support the readyState property
// and the onreadystate event so we patch it!
if (doc.readyState == null) {
doc.readyState = 1;
doc.addEventListener("load", function () {
doc.readyState = 4;
if (typeof doc.onreadystatechange == "function") doc.onreadystatechange();
}, false);
}
return doc;
}
// Micro$oft
if (window.ActiveXObject) return new ActiveXObject(getDomDocumentPrefix() + ".DomDocument");
}
catch (ex) {}
throw new Error("Your browser does not support XmlDocument objects");
}
// Create the loadXML method and xml getter for Mozilla
if (window.DOMParser && window.XMLSerializer && window.Node && Node.prototype && Node.prototype.__defineGetter__) {
// XMLDocument did not extend the Document interface in some versions
// of Mozilla. Extend both!
Document.prototype.loadXML = function (s) {
// parse the string to a new doc
var doc2 = (new DOMParser()).parseFromString(s, "text/xml");
// remove all initial children
while (this.hasChildNodes()) this.removeChild(this.lastChild);
// insert and import nodes
for (var i = 0; i < doc2.childNodes.length; i++) {
this.appendChild(this.importNode(doc2.childNodes[i], true));
}
}
// XML getter
// This serializes the DOM tree to an XML String
// XMLDocument did not extend the Document interface in some versions
// of Mozilla. Extend both!
Document.prototype.__defineGetter__("xml", function () {
return (new XMLSerializer()).serializeToString(this);
});
}
// -->
</SCRIPT>
</head>
<body onload="init();">
<!--webbot bot="PurpleText" PREVIEW="headlines" -->
<!--webbot bot="HTMLMarkup" startspan -->
<span class=qwhead >nieuwsarchief:</a></b>
<div id="headlines"></div>
<script language="VBScript" type="text/vbscript">
Function VBopenLink(url)
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run("mozilla.exe "+url)
end Function
</script>
</span>
<!--webbot bot="HTMLMarkup" endspan i-checksum="44376" -->
<!--webbot bot="PurpleText" PREVIEW="end headlines" -->
</body>
</html> |
en wie weet hoe ik <pubDate>Mon, 06 Dec 2004 05:40:05 GMT</pubDate>
met javascript kan omzetten naar 6-12-2004 17:40 uur