Uncaught TypeError when calling a Javascript Function in Android -


i android developer , new javascript. controlling webview activity using javascript. in login page when use java script functions getting huge errors. please guide me avoid these errors.

code:

web.loadurl("javascript:document.getelementbyid(\"umail\").value = \""         + email + "\";"); web.loadurl("javascript:document.getelementbyid(\"password\").value = \""         + pwd + "\";"); web.loadurl("javascript:document.getelementbyid(\"confirmpassword\").value = \""         + confirm_pwd + "\";"); web.loadurl("javascript:func_register_step1('signin')");  web.loadurl("javascript:window.jsinterface.geterrormsg(document.getelementbyid('errormessagetd').innerhtml);"); web.loadurl("javascript:window.jsinterface.getwarningmsg(document.getelementbyid('warning_msg').innerhtml);"); 

error:

05-15 11:52:28.310: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:28.310: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:28.310: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:28.310: e/web console(3722): uncaught referenceerror: func_register_step1 not defined @ null:1 05-15 11:52:28.310: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:28.310: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:31.240: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:31.240: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:31.240: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:31.240: e/web console(3722): uncaught referenceerror: func_register_step1 not defined @ null:1 05-15 11:52:31.250: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:31.250: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:33.590: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:33.590: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:33.590: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:33.590: e/web console(3722): uncaught referenceerror: func_register_step1 not defined @ null:1 05-15 11:52:33.600: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:33.600: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:40.260: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:40.270: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:40.270: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:40.270: e/web console(3722): uncaught referenceerror: func_register_step1 not defined @ null:1 05-15 11:52:40.270: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:40.270: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:41.290: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:41.290: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:41.290: e/web console(3722): uncaught typeerror: cannot set property 'value' of null @ null:1 05-15 11:52:41.290: e/web console(3722): uncaught referenceerror: func_register_step1 not defined @ null:1 05-15 11:52:41.290: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 05-15 11:52:41.290: e/web console(3722): uncaught typeerror: cannot read property 'innerhtml' of null @ null:1 

according thrown errors, seems document.getelementbyid(...) returns null. , applying .value , .innerhtml null throw errors.

i suspect page not loaded when call javascript function. when call javascript, mean in method? sure page loaded, can call loadurl in onpagefinished method of webviewclient object.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -