我将 var todo = document.getElementById("todo").value;
改成 var todo = form.todo.value,那JS就失效了,那要怎样啦
改成 var todo = form.todo.value,那JS就失效了,那要怎样啦
<script type="text/javascript"> function check(){ var todo = document.getElementById("todo"); todo.value="moment"; alert(todo.value); } </script><form method="post" action="test1.jsp"> <input type="hidden" name="todo" value=""/> <input type="submit" value="submit" onclick="check()"> </form><% String s=request.getParameter("todo"); out.println(s+"<br>"); %>