0

我正在开发 Google chrome 扩展程序。这个想法是我输入我的用户名和密码,单击提交并在我的网站上打开一个新选项卡,然后它将拿起提交的表格并登录我。

我已设法在新标签页中打开我的网站,但无法获取表单。

4

3 回答 3

0

Since you've got your website loaded, try using jquery to select the textbox and enter a value.

The following selects the where the input is, then finds the input I want, then finally sets the value inside of that box.

$("td[data-key='sku']").find("input.tb-input").val('some text here')

In the jquery code above, the html would look something like this:

<td data-key='sku'>
<input class=tb-input/>
</td>
于 2012-10-11T22:28:34.720 回答
0

您可以在 popup.html 中创建一个 HTML 表单,如下所示:

<form name="input" action="http://example.com/login.php" method="get">
    Username: <input type="text" name="user">
    Password: <input type="password" name="password">
<input type="submit" value="Submit"></form>

在您网站的脚本中,您可以检查参数是否已通过,如果正确,则创建将它们重定向到您网站上的仪表板,否则向他们显示登录页面以输入正确的凭据

于 2012-10-03T21:15:13.820 回答
0

您可以在提交按钮中使用 OnClick 事件:

<input type="submit" value="submit" onclick="this.form.target='_blank';return true;"> 
于 2012-10-03T14:02:58.283 回答