简体   繁体   English

如何更改其他人页面上输入的值?

[英]How to change the value on a input in someone else page?

<div class="xCoord">
    <label for="xCoordInput">X:</label>
    <input value="" name="x" id="xCoordInput" class="text coordinates x ">
</div>

What I would like to do is to change this value ( xCoordInput ) on someone else website? 我想做的就是在其他网站上更改此值( xCoordInput )? This is a game and I don't know how I would change their website from my own website. 这是一个游戏,我不知道如何从自己的网站更改他们的网站。

I like to autofill forms with a bookmarklet . 我喜欢用小书签自动填充表格。 I use them at work to fill out tedious forms when I am testing webpages. 测试网页时,我会在工作中使用它们填写繁琐的表格。 To build one create a bookmark and edit the url value of the bookmark to hold a javascript function object like this one. 要构建一个,创建一个书签并编辑书签的url值以容纳一个像这样的javascript函数对象。

javascript:(function(){ 
    var xCoord = document.getElementsByClassName("xCoord")[0];
    xCoord.getElementsByTagName("input")[0].value="whatever";  
})();

Nothing about doing this in principle is wrong or illegal unless you are using it to cheat or break the law. 除非您使用它来欺骗或违反法律,否则原则上没有做错事或违法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM