Hallo,
kann mir jemand weiterhelfen? Und zwar geht es um dieses Script:
|
Quellcode
|
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
|
<head>
<title>URL_getter</title>
<script language="javascript">
var http_request = false; //globale Request Variable
var count = 5;
function macheRequest(url)
{
if(count > -1)
return false;
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Kann Instanz nicht erzeugen');
return false;
}
http_request.onreadystatechange = getCont;
http_request.open('GET', url, true);
http_request.send(null);
}
function getCont()
{
if (http_request.readyState == 4)
{
if (http_request.status == 200)
alert(http_request.responseText);
else
alert('Problem beim Request');
}
}
function countdown()
{
elem = document.getElementById("counter");
if(elem.firstChild != "[object Text]")
{
text = document.createTextNode(count);
elem.appendChild(text);
}
else
{
elem.firstChild.nodeValue = count;
}
count--;
if(count >= 0)
setTimeout("countdown()",1000);
else
{
elem2 = document.getElementById("getURL");
elem2.style.backgroundColor = "lightgreen";
text=document.createTextNode("klick mich");
elem2.appendChild(text);
}
}
</script>
</head>
<body onload="countdown();">
<div style="height: 40px; width: 100px; margin: 200px auto auto; border: 1px solid blue;">
<div id="counter" style="height: 20px; text-align: center;"></div>
<div id="getURL" onclick="macheRequest('test.html')" style="text-align: center; width: 100%; height: 20px; background-color: red;"></div>
</div>
</body>
|
Ist es möglich, anstatt den Text ein Bild mit Verlinkung auszugeben?
Würde mich freuen.
Gruß