簡體   English   中英

如何預填充文本字段並單擊URL的提交按鈕

[英]How to pre-fill text fields and click the submit button of a URL

我想打開一個URL,例如http://www.facebook.com 如何從一頁打開它,並將輸入字段的值設置為我的憑據,然后自動單擊登錄按鈕。 我發現以下代碼片段:

<p>Your name:
<br /><input name="name" id="name" /></p>

<p>Your email:
<br /><input name="email" id="email" /></p>


<script>

var hashParams = window.location.hash.substr(1).split('&'); // substr(1) to remove the #
for(var i = 0; i < hashParams.length; i++){
var p = hashParams[i].split('=');
     document.getElementById(p[0]).value = decodeURIComponent(p[1]);;
}

產生此URL: www.xyz.com/contact.html#name=some_text&email=more%20text&username=john&age=23 (不計學分)。

但是我不確定在哪里輸入要命中的URL。

檢查頁面並在HTML中找到登錄字段。

對於Facebook,請使用:

document.getElementById("email").innerHTML = "YourEmail";
document.getElementById("pass").innerHTML = "yourpass";

在網址中,嘗試添加

<script>document.getElementById("email").innerHTML = "YourEmailhere";
document.getElementById("pass").innerHTML = "yourpasshere";</script>

在Facebook.com之后

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM