开发者

JavaScript Frames Manipulation

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜