我想用JavaScript登錄網站,我不知道它是允許的。我在url中使用了javascript代碼,它在賦值 處發生無效的左手邊錯誤:1:10。在url中使用Javascript函數
javascript:document.getElementById("OtherUsername")="myid";document.getElementById("OtherPassword")="mypassword";$("#btnSend").click();
我想用JavaScript登錄網站,我不知道它是允許的。我在url中使用了javascript代碼,它在賦值 處發生無效的左手邊錯誤:1:10。在url中使用Javascript函數
javascript:document.getElementById("OtherUsername")="myid";document.getElementById("OtherPassword")="mypassword";$("#btnSend").click();
由於維諾德說,你想分配myid
(字符串)document.getElementById("OtherUsername")
,一個對象。這是行不通的。你需要將它分配給document.getElementById("OtherUsername").value
這應該工作:
javascript:document.getElementById("OtherUsername").value="myid";document.getElementById("OtherPassword").value="mypassword";$("#btnSend").click();
,如果他們有jQuery的活躍在該網站上的最後一位$("#btnSend").click();
只會工作,或者如果包括它通過使用插件莫名其妙。
不能將值分配給DOM元素
如果OtherUsername元素和OtherPassword元素是一個形式,你可以按照我的代碼
document.getElementById("OtherUsername").value="myid";
document.getElementById("OtherPassword").value="mypassword";
$("#btnSend").submit(); //btnSend should be the from id
你需要使用value屬性'文件.getElementById(「OtherUsername」).value =「myuid」',不知道你在做什麼,但你是混合jquery n JS –