<html>
<head>
<meta charset="utf-8">
</head>
<body>
<input type="text" value="请输入用户名" name="username">
</body>
<script>
document.getElementsByName('username')[0].setAttribute('type','button');//获得的是一个数组,一定要有下标来确定。
</script>
</html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<input type="text" value="请输入用户名" name="username">
</body>
<script>
document.getElementsByName('username')[0].setAttribute('type','button');//获得的是一个数组,一定要有下标来确定。
</script>
</html>