Sử dụng document.forms[0].name để truy xuất thuộc tính name của form đầu tiên trong tập hợp document.forms.
Ví dụ
<!DOCTYPE html>
<html>
<body>
<form name="formOne">
Name: <input type="text" name="my_name" value="Amit">
Subject: <input type="text" name="my_subject" value="Java">
<input type="submit" value="Submit">
</form>
<form name="formTwo"></form>
<script>
var val = document.forms.length;
document.write("<br>Số form: " + val);
document.write("<br>Tên form đầu tiên: " + document.forms[0].name);
</script>
</body>
</html>