效果展示:
input-output.png<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<body>
<!--
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)" id="form1">0
<input type="range" id="a" value="50" max="200">200
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>
</form>
-->
<form oninput = "x.value=parseInt(a.value)+parseInt(b.value)">
0<input type="range" id="a" value="50">
</input>+
<input type="number" id='b' value= '50'/>
=<output name="x" for = 'a b'></output>
</form>
<p><b>注释:</b>Internet Explorer 不支持 <output> 标签。</p>
<script type="text/javascript">
var oForm = document.getElementById('form1');
var oA = document.getElementById('a');
var str = [1,2,3]
console.log(str.reverse())
/*oForm.oninput = function(){
console.log("input"+a.value)
}
oForm.onchange = function(){
console.log("change"+a.value);
}*/
</script>
</body>
</html>
网友评论