嗨,对不起,我是 Javascript 的新手,但我需要知道当我有这种表单时如何重新填充表单字段:
我尝试使用此代码(部分)但它不起作用,文件名是'testjavascript.html'
<head>
<script language="javascript" type="text/javascript">
function updateUsername(){
var first = document.getElementById("first").value;
document.getElementById("first").value = first;
} </script>
</head>
<body>
<form action="action.php" method="post">
<input type="text" name="usename" value="" id="first" >
<a href="testjavascript.html?auto=1" onclick="updateUsername();" id ="link">Link</a>
<input type="submit" name="submit">
</form>
</body>