-6
想知道是否有可能获得被推入数组的对象的变量或函数 想要添加数组中的所有对象,其中该函数将获得字符串内容以网页数组中对象的变量
我目前有:
recordjs
var recordArray = [];
function EmailRecord(name, email) {
this.name = name;
this.email = email;
this.getRecord = function() {
return this.name+"|"+this.email;
};
}
function addRecord(){
var n1 = document.getElementById("name").value;
var e1 = document.getElementById("email").value
var aRecord = new EmailRecord(n1,e1);
recordArray.push(aRecord);
}
index.html
<label>Name: </label><input type="text" id="name"/>
<label>Email </label><input type="text" id="email"/>
<br/>
<input type="button" value="Add a record" onclick="addRecord()"/>
<p id="p1"></p>
所以你想了解的变量或只是内容的名字吗? –
想要使用的内容 –
你的问题是相当神秘。请为我们提供一些代码,让我们更好地了解您要做的事情。 –