[Opgelost] DIV niet gevonden?
Krijg is een foutmelding als hij wordt geprobeerd uitgelezen te worden.
Quote:
Foutdetails webpagina
Gebruikersagent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Tijdstempel: Tue, 19 May 2009 06:48:44 UTC
Bericht: 'ajx_proc.innerHTML' is leeg of geen object
Regel: 57
Teken: 1
Code: 0
Gebruikersagent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Tijdstempel: Tue, 19 May 2009 06:48:44 UTC
Bericht: 'ajx_proc.innerHTML' is leeg of geen object
Regel: 57
Teken: 1
Code: 0
In het volgende JS bestand:
Code (php)
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
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
var random = 0;
function go_register(frmhandler) {
random = Math.round( Math.random() * 9999 );
var errgive = 0;
frmhandler.username.value = ucfirst(strtolower(frmhandler.username.value));
if ( frmhandler.username.value == '' || frmhandler.password.value == '' || frmhandler.confirmpassword.value == '' || frmhandler.email.value == '' ) { disp_error('You need to fill in all the fields!'); errgive = 1; }
if ( frmhandler.password.value != frmhandler.confirmpassword.value && !errgive ) { disp_error('Passwords are not the same!'); errgive = 1; }
if ( frmhandler.password.value.length < 4 && !errgive ) { disp_error('Password too short!'); errgive = 1; }
if ( ( frmhandler.email.value.indexOf('@') == -1 || frmhandler.email.value.indexOf('.') == -1 ) && !errgive ) { disp_error('E-Mail invalid!'); errgive = 1; }
if ( !frmhandler.tandc.checked && !errgive ) { disp_error('You need to agree to the Usage Agreement in order to play.'); errgive = 1; }
if ( !errgive )
{
var regdata = frmhandler.username.value+';'+frmhandler.password.value+';'+frmhandler.email.value+';';
ajaxpagefetcher.load('ajx_proc', './index.php?process=register®dat='+regdata+'&sid='+random, true, 'test_register()');
}
}
function test_register() {
var res = ajx_proc.innerHTML.split('_');
var errgive = 0;
if ( res[2] == random && res[0] == 'reg' )
{
errgive = 0;
if ( res[1] == 'utaken' ) { disp_error('Username has already been taken!'); errgive = 1; }
if ( res[1] == 'etaken' ) { disp_error('E-Mail adress has already been taken!'); errgive = 1; }
if ( res[1] == 'hack' ) { disp_error('Registration error or hack!'); errgive = 1; }
if ( !errgive && res[1] == 'success' )
{
errstr.style.backgroundColor = 'green';
disp_error('You have been succesfully registered. Redirecting to login screen in 5 seconds...');
for( i = 5; i != 1; i-- )
{
setTimeout('window.location = \'./index.php?page=home\';', 5000);
}
}
}
else
{
setTimeout('test_register()', 0500);
}
}
function go_login(frmhandler) {
random = Math.round( Math.random() * 9999 );
var errgive = 0;
frmhandler.login_username.value = ucfirst(strtolower(frmhandler.login_username.value));
if ( frmhandler.login_username.value == '' || frmhandler.login_password.value == '' ) { disp_error('You need to fill in all the fields!'); errgive = 1; }
if ( !errgive )
{
var lgndata = frmhandler.login_username.value+';'+frmhandler.login_password.value+';';
ajaxpagefetcher.load('ajx_proc', './index.php?process=login&lgndat='+lgndata+'&sid='+random, true, 'test_login()');
}
}
function test_login() {
var res = ajx_proc.innerHTML.split('_');
var errgive = 0;
if ( res[2] == random && res[0] == 'lgn' )
{
errgive = 0;
if ( res[1] == 'wronginfo' ) { disp_error('The login information you have entered is incorrect.'); errgive = 1; }
if ( res[1] == 'usage' ) { dispusage(); errgive = 1; }
if ( !errgive && res[1] == 'success' )
{
window.location = './index.php?page=game';
}
}
else
{
setTimeout('test_login()', 0500);
}
}
function disp_error(msg) {
errstr.innerHTML = msg;
$('errstr').appear();
setTimeout("$('errstr').fade();", 5000);
}
function ucfirst( str ) {
str += '';
var f = str.charAt(0).toUpperCase();
return f + str.substr(1);
}
function strtolower( str ) {
return (str+'').toLowerCase();
}
function checkforagree(myfield) {
if ( myfield.scrollTop == ( myfield.scrollHeight - 100 ) )
{
regifrm.regi_butt.disabled = '';
}
else
{
regifrm.regi_butt.disabled = 'disabled';
}
}
function usageload() {
ajaxpagefetcher.load('usagefield', './index.php?page=usage', true);
}
function dispusage() {
$('mainloginscreen').fade();
$('usagefield').appear();
}
function declineusage() {
$('mainloginscreen').appear();
$('usagefield').fade();
lgnfrm.login_username.value = '';
lgnfrm.login_password.value = '';
}
function acceptusage() {
lgnfrm.action = './index.php?process=usage';
lgnfrm.submit();
}
function go_register(frmhandler) {
random = Math.round( Math.random() * 9999 );
var errgive = 0;
frmhandler.username.value = ucfirst(strtolower(frmhandler.username.value));
if ( frmhandler.username.value == '' || frmhandler.password.value == '' || frmhandler.confirmpassword.value == '' || frmhandler.email.value == '' ) { disp_error('You need to fill in all the fields!'); errgive = 1; }
if ( frmhandler.password.value != frmhandler.confirmpassword.value && !errgive ) { disp_error('Passwords are not the same!'); errgive = 1; }
if ( frmhandler.password.value.length < 4 && !errgive ) { disp_error('Password too short!'); errgive = 1; }
if ( ( frmhandler.email.value.indexOf('@') == -1 || frmhandler.email.value.indexOf('.') == -1 ) && !errgive ) { disp_error('E-Mail invalid!'); errgive = 1; }
if ( !frmhandler.tandc.checked && !errgive ) { disp_error('You need to agree to the Usage Agreement in order to play.'); errgive = 1; }
if ( !errgive )
{
var regdata = frmhandler.username.value+';'+frmhandler.password.value+';'+frmhandler.email.value+';';
ajaxpagefetcher.load('ajx_proc', './index.php?process=register®dat='+regdata+'&sid='+random, true, 'test_register()');
}
}
function test_register() {
var res = ajx_proc.innerHTML.split('_');
var errgive = 0;
if ( res[2] == random && res[0] == 'reg' )
{
errgive = 0;
if ( res[1] == 'utaken' ) { disp_error('Username has already been taken!'); errgive = 1; }
if ( res[1] == 'etaken' ) { disp_error('E-Mail adress has already been taken!'); errgive = 1; }
if ( res[1] == 'hack' ) { disp_error('Registration error or hack!'); errgive = 1; }
if ( !errgive && res[1] == 'success' )
{
errstr.style.backgroundColor = 'green';
disp_error('You have been succesfully registered. Redirecting to login screen in 5 seconds...');
for( i = 5; i != 1; i-- )
{
setTimeout('window.location = \'./index.php?page=home\';', 5000);
}
}
}
else
{
setTimeout('test_register()', 0500);
}
}
function go_login(frmhandler) {
random = Math.round( Math.random() * 9999 );
var errgive = 0;
frmhandler.login_username.value = ucfirst(strtolower(frmhandler.login_username.value));
if ( frmhandler.login_username.value == '' || frmhandler.login_password.value == '' ) { disp_error('You need to fill in all the fields!'); errgive = 1; }
if ( !errgive )
{
var lgndata = frmhandler.login_username.value+';'+frmhandler.login_password.value+';';
ajaxpagefetcher.load('ajx_proc', './index.php?process=login&lgndat='+lgndata+'&sid='+random, true, 'test_login()');
}
}
function test_login() {
var res = ajx_proc.innerHTML.split('_');
var errgive = 0;
if ( res[2] == random && res[0] == 'lgn' )
{
errgive = 0;
if ( res[1] == 'wronginfo' ) { disp_error('The login information you have entered is incorrect.'); errgive = 1; }
if ( res[1] == 'usage' ) { dispusage(); errgive = 1; }
if ( !errgive && res[1] == 'success' )
{
window.location = './index.php?page=game';
}
}
else
{
setTimeout('test_login()', 0500);
}
}
function disp_error(msg) {
errstr.innerHTML = msg;
$('errstr').appear();
setTimeout("$('errstr').fade();", 5000);
}
function ucfirst( str ) {
str += '';
var f = str.charAt(0).toUpperCase();
return f + str.substr(1);
}
function strtolower( str ) {
return (str+'').toLowerCase();
}
function checkforagree(myfield) {
if ( myfield.scrollTop == ( myfield.scrollHeight - 100 ) )
{
regifrm.regi_butt.disabled = '';
}
else
{
regifrm.regi_butt.disabled = 'disabled';
}
}
function usageload() {
ajaxpagefetcher.load('usagefield', './index.php?page=usage', true);
}
function dispusage() {
$('mainloginscreen').fade();
$('usagefield').appear();
}
function declineusage() {
$('mainloginscreen').appear();
$('usagefield').fade();
lgnfrm.login_username.value = '';
lgnfrm.login_password.value = '';
}
function acceptusage() {
lgnfrm.action = './index.php?process=usage';
lgnfrm.submit();
}
P.S. ajaxpagefetcher.load(containerid, url, buffer, endact); is een functie die een webpagina laad binnen in een DIV of SPAN
Gewijzigd op 01/01/1970 01:00:00 door Rens Rikkerink
(jx_proc.innerHTML is leeg)
Voor de rest is je code onoverzichtelijk en een rotzooitje, ik ga hier verder niet naar kijken. Word het wel aangeroepen nadat de pagina is geladen?
Kan je trouwens zien of het een fatal error is of eerder iets als een warning.
Het bericht krijgen dat een div geen innerHTML heeft, wel, er zijn ergere dingen in de wereld. Dat lijkt me niet echt een fout.
Van waar komt de load() functie trouwens?
Chris Kortaan schreef op 19.05.2009 10:21:
Voor de rest is je code onoverzichtelijk en een rotzooitje, ik ga hier verder niet naar kijken. Word het wel aangeroepen nadat de pagina is geladen?
Als je er niet na wilt kijken en niet wilt helpen, reageer dan gewoon niet.
fatal error, want verder doet hij niks meer
Gewijzigd op 01/01/1970 01:00:00 door Rens Rikkerink
var res = ajx_proc.innerHTML.split('_');
In die functie is ajx_proc niet gedefinieerd.
Maak daar eens van:
var ajx_proc = document.getElementById('ajx_proc');
var res = ...
Gewijzigd op 01/01/1970 01:00:00 door Emmanuel Delay
Bedankt! Dat werkte!