利用JavaScript实现文本框改文字功能

<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
    function settext(){
        var otext=document.getElementById('text1');
        otext.value='123';
    }
</script>
</head>

<body>
<input id="text1" type="text" value="abc" />
<input type="button" value="改文字" onClick="settext()" />
</body>
</html>

 另一种方法:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>

输入:<input type="text" >

显示:<input  />

<script type="text/javascript">
window.onload = function () {
locationInput = function () {
};
}
</script>

<script>
function myFunction() {
var x = document.getElementById("myInput").value;
document.getElementById("demo").value = x;
}
</script>
</body>
</html>