首页javascriptinputJavascript Form - 如何更改input.value返回的内容

Javascript Form - 如何更改input.value返回的内容

我们想知道如何更改input.value返回的内容。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
HTMLInputElement.prototype.MyValue = function() {
    return this.value + this.value;
};
window.onload = function() {
    var input = document.getElementById("i");
    console.log(input.MyValue());
};

</script>
</head>
<body>
  <input type="text" value="a" id="i" />
</body>
</html>