RetroZilla/webshell/tests/viewer/samples/test8dom.html
2015-10-20 23:03:22 -04:00

65 lines
1.5 KiB
HTML

<html>
<body>
<form>
<input type=button value="change value attribute" onclick="changeValues(0)"> &nbsp;
<button onclick="changeSizes()">change size attribute</button>
<BR>
<input type=button value="change checked attribute" onclick="changeChecked()"> &nbsp;
<BR>
<input type=submit value=submit>
<input type=reset value=reset>
<input type=button value=button>
<INPUT type=image src=raptor.jpg width=50 height=50 name=imageSubmit value="js bug">
<BR>
<input type=checkbox checked value="js bug">
<input type=checkbox value="js bug">
<input type=radio name=radio checked value="js bug">
<input type=radio name=radio value="js bug">
<BR>
<button>html4 button</button>
<input type=text value=foo>
<textarea>foobar</textarea>
</form>
<script>
var numInputChangers = 2;
var inputs = document.getElementsByTagName("INPUT");
var numInputs = inputs.length;
var inputValues = new Array(numInputs+numInputs);
var start = 0;
for (var i = 0; i < numInputs; i++) {
inputValues[i] = inputs[i].value;
inputValues[numInputs+i] = "CHANGED"
}
function changeValues(aNativeChanger) {
if (start == 0) {
start = numInputs;
}
else {
start = 0;
}
for (var i = numInputChangers; i < numInputs; i++) {
inputs[i].value = inputValues[start+i];
}
}
function changeSizes() {
inputs[2].size = 100;
inputs[3].size = 100;
inputs[4].size = 100;
inputs[11].size = 10;
}
function changeChecked() {
inputs[6].checked = false;
inputs[7].checked = true;
inputs[8].checked = false;
inputs[9].checked = true;
}
</script>
</body>
</html>