volgende code:
Voorbeeld staat op de volgende URL:
http://www.xs4all.nl/~rickr/map/map.html
Op het moment van plaatsen en daarna klikken 'Sla op' dan zouden de nieuwe coordinaten ingevoegd moeten worden in de cookie... echter dit gebeurt niet!
Ik mis een aantal triviale functies of 'if' statements...
Ik kom er echter niet uit...
Iemand??
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
| <html>
<head>
<title> Vlag op kaart <test> </title>
<style type="text/css">
div{font-family:tahoma; font-size:8pt; color:gray; padding:3;}
</style>
<script language="javascript" src="src/dynobject.js"></script>
<script language="javascript" src="src/dynevents.js"></script>
<script language="javascript" src="src/dragdrop.js"></script>
<script>
function Cookie(document, name, hours, path, domain, secure) {
this.$document = document;
this.$name = name;
if (hours)
this.$expiration = new Date((new Date()).getTime() + hours*3600000);
else this.$expiration = null;
if (path) this.$path = path; else this.$path = null;
if (domain) this.$domain = domain; else this.$domain = null;
if (secure) this.$secure = true; else this.$secure = false;
}
function _Cookie_store()
{
var cookieval = "";
for(var prop in this) {
if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function'))
continue;
if (cookieval != "") cookieval += '&';
cookieval += prop + ':' + escape(this[prop]);
}
var cookie = this.$name + '=' + cookieval;
if (this.$expiration)
cookie += '; expires=' + this.$expiration.toGMTString();
if (this.$path) cookie += '; path=' + this.$path;
if (this.$domain) cookie += '; domain=' + this.$domain;
if (this.$secure) cookie += '; secure';
this.$document.cookie = cookie;
}
function _Cookie_load()
{
var allcookies = this.$document.cookie;
if (allcookies == "") return false;
var start = allcookies.indexOf(this.$name + '=');
if (start == -1) return false;
start += this.$name.length + 1;
var end = allcookies.indexOf(';', start);
if (end == -1) end = allcookies.length;
var cookieval = allcookies.substring(start, end);
var a = cookieval.split('&');
for(var i=0; i < a.length; i++)
a[i] = a[i].split(':');
for(var i = 0; i < a.length; i++) {
this[a[i][0]] = unescape(a[i][1]);
}
return true;
}
function _Cookie_remove()
{
var cookie;
cookie = this.$name + '=';
if (this.$path) cookie += '; path=' + this.$path;
if (this.$domain) cookie += '; domain=' + this.$domain;
cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';
this.$document.cookie = cookie;
}
new Cookie();
Cookie.prototype.store = _Cookie_store;
Cookie.prototype.load = _Cookie_load;
Cookie.prototype.remove = _Cookie_remove;
var flgCoords = new Cookie(document, "xcoor_ycoor", 240);
flgCoords.xcoor = ""
flgCoords.ycoor = ""
document.attachEvent('onload', 'startMe()');
var layer1, layer2;
function startMe() {
layer1 = new dynObject('first');
layer1.setProperties(50,50,800,515, 'visible', 'images/usamap3.gif', 4)
//LAYER2
layer2 = new dynObject('second', 'first');
layer2.setProperties(815,160,30,30, 'visible', 'images/flag.gif');
layer2.slideTo(flgCoords.xcoor,flgCoords.ycoor,500,1)
document.attachEvent('onmousemove', 'showCoords()');
layer2.enableDragDrop();
layer2.limitMovement(0,0,825,515);
}
function init() {
}
function colorMe(color) {
activeObj.setBackground(color)
}
function showCoords() {
window.status = layer2.x +' '+ layer2.y
}
</script>
</head>
<body>
<input type="button" value="Sla op" onClick="flgCoords.store()">
<input type="button" value="Haal weg" onClick="flgCoords.remove()">
</body>
</html> |
Voorbeeld staat op de volgende URL:
http://www.xs4all.nl/~rickr/map/map.html
Op het moment van plaatsen en daarna klikken 'Sla op' dan zouden de nieuwe coordinaten ingevoegd moeten worden in de cookie... echter dit gebeurt niet!
Ik mis een aantal triviale functies of 'if' statements...
Ik kom er echter niet uit...
Iemand??