Ik heb het volgende javascriptje:
Het probleem is, dat dit script mij voor p wel 58 retourneert, maar een error genereert voor r: "urlVariables is undefined". Dit snap ik niet, want als ik zeg:
krijg ik wel gewoon http://localhost/website/index.php?id=23 retour. Wat doe ik voud?!
HTML:
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
| <script language="javascript"> function urlVariables(theURL, strVar){ url = theURL.search.substr(1).split("?"); urlVar = new String(url); arrUrl = urlVar.split("&"); for(x=0; x<arrUrl.length; x++){ arrU = arrUrl[x].split("="); if (arrU[0] == strVar){ intVar = arrU[1]; x = arrUrl.length; } } return(intVar); } p = parseInt(urlVariables(document.location, 'id')); r = parseInt(urlVariables(document.referrer, 'id')); alert(p+"\n"+r); </script> ... hierbij is document.location: http://localhost/website/index.php?id=58 en document.referrer: http://localhost/website/index.php?id=23 |
Het probleem is, dat dit script mij voor p wel 58 retourneert, maar een error genereert voor r: "urlVariables is undefined". Dit snap ik niet, want als ik zeg:
HTML:
1
2
3
4
5
| ... zelfde meuk als boven ... r = document.referrer; alert(p+"\n"+r); |
krijg ik wel gewoon http://localhost/website/index.php?id=23 retour. Wat doe ik voud?!
[ Voor 7% gewijzigd door Reveller op 16-05-2004 18:51 ]
"Real software engineers work from 9 to 5, because that is the way the job is described in the formal spec. Working late would feel like using an undocumented external procedure."