开发者

JavaScript Frames Manipulation

开发者 https://www.devze.com 2023-04-11 23:27 出处:网络
I have a piece of javascript with Phonegap application which works nice on iPhone but on Android it doesn\'t work.

I have a piece of javascript with Phonegap application which works nice on iPhone but on Android it doesn't work.

var js = "var c = frames.content;";

js += "if (c.document.readyState == 'complete') {";
开发者_如何学Python
js += "var l = c.document.getElementsByName('login')[1];";

js += "var u = c.document.getElementById('user_id');";
js += "var p = c.document.getElementById('password');";

js += "if (u && p) {";

js += "u.value = '" + getData("username") + "';";
js += "p.value = '" + getData("password") + "';";

js += "l.click();";

js += "}";

js += "}";

The Android browser says there is frames object which is of type DOMWindow but there is no child frame named content. What I am doing wrong?

UPDATED I solved it. I wasn't executing the JavaScript in the right WebView.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号