好的,我正在编写一些代码,有人可以将其用作书签来实时混淆输入框的值...
var elements = document.getElementsByTagName("input");
for (var ii = 0; ii < elements.length; ii++) {
elements[ii].addEventListener("keyup", function() {
var input = elements[ii].value;
var a = [""];
var gen;
for (x in input) {
a[x] = input[input.length - x - 1];
};
for (x in a) {
var gen = gen + a[x];
};
output = gen.replace('undefined', '');
elements[ii].value = output;
}, false);
};
此代码(前面带有 JavaScript:)对任何输入框都没有影响。谁能明白为什么?
谢谢!