js数组存储数据,在html添加数据时undefined
数组:
```javascript
var list = [{ "Id": '0', "FirstName": "Stark", "LastName": "Bill", "DateOfBirth": "2000/10/11", "Gender": "Male", "PrimaryInsurance": "Medicare", "Address": "ddadsdasd", "ContactNumber": "1338872818738", "NextOfKin": "weqe" },
{ "Id": '1', "FirstName": "Shown", "LastName": "Jenny", "DateOfBirth": "2000/10/11", "Gender": "Male", "PrimaryInsurance": "Medicare", "Address": "ddadsdasd", "ContactNumber": "1338872818738", "NextOfKin": "weqe" },
{ "Id": '2', "FirstName": "Geogrge", "LastName": "Hash", "DateOfBirth": "2000/10/11", "Gender": "Male", "PrimaryInsurance": "Medicare", "Address": "ddadsdasd", "ContactNumber": "1338872818738", "NextOfKin": "weqe" },
{ "Id": '3', "FirstName": "Intwre", "LastName": "zaiwoo", "DateOfBirth": "2000/10/11", "Gender": "Male", "PrimaryInsurance": "Medicare", "Address": "ddadsdasd", "ContactNumber": "1338872818738", "NextOfKin": "weqe" },
{ "Id": '4', "FirstName": "Niko", "LastName": "baby", "DateOfBirth": "2000/10/11", "Gender": "Male", "PrimaryInsurance": "Medicare", "Address": "ddadsdasd", "ContactNumber": "1338872818738", "NextOfKin": "weqe" }];
html:
Add a new patient
Patient ID*:<input type="text" id="newId" value="">
First name*:<input type="text" id="newFirstName" value="">
Last name*:<input type="text" id="newLastName" value="">
Date of birth *:<input type="text" id="newDateOfBirth" value="">
Gender*:<input type="text" id="newGender" value="">
Primary insurance*:<input type="text" id="newPrimaryInsurance" value="">
Address *:<input type="text" id="newAddress" value="">
Contact number *:<input type="text" id="newContactNumber" value="">
Next of kin:<input type="text" id="newNextOfKin" value="">
<input type="button" value="Add a new Patient" onclick="addNewPatient();">
Javascript:
function addNewPatient(){
var newId=document.getElementById("newId");
var newFirstName=document.getElementById("newFirstName");
var newLastName=document.getElementById("newLastName");
var newDateOfBirth=document.getElementById("newDateOfBirth");
var newGender=document.getElementById("newGender");
var newPrimaryInsurance=document.getElementById("newPrimaryInsurance");
var newAddress=document.getElementById("newAddress");
var newContactNumber=document.getElementById("newContactNumber");
var newNextOfKin=document.getElementById("newNextOfKin");
var newPatient=new Array(newId.value,newFirstName.value,newLastName.value,newDateOfBirth.value,newGender.value,newPrimaryInsurance.value,newAddress.value,newContactNumber.value,newNextOfKin.value);
list.push(newPatient);
refreshList();
}
错误:
请问改怎么解决这个问题