我在html中創建表單,我想在javascript數組中添加表單值。我該怎麼做?如何在javascript數組中輸入HTML輸入?
<!DOCTYPE html>
<html>
<head>
<script src="array.js" type="text/JavaScript"></script>
</head>
<body>
<h2>Input Array</h2>
<form method="post">
<input type="text" id="first"/>
<input type="text" id="second"/>
<input type="text" id="third"/>
<input type="text" id="fourth" />
<input type="button" value="Submit" OnClick="array();"/>
</form>
</body>
</html>
JavaScript數組中的這四個值並將它們打印在同一頁上。
目的是什麼?爲什麼不使用serialize()? –
我是新來javascript定義請。 –
你爲什麼要數組? –