//push add a new item into Array
if(typeof(Array.prototype.push)!="function")
Array.prototype.push = function(item){
this[this.length] = item; return this.length;};你自己加嘛
if(typeof(Array.prototype.push)!="function")
Array.prototype.push = function(item){
this[this.length] = item; return this.length;};你自己加嘛
解决方案 »
- Ext 文件上传 fileuploadfield 帮帮忙 急呀
- 请问从 HTML 代码中提取 javascript 代码的正则表达式该怎么书写?我写的不正确。
- 一段JS+FLash的幻灯小代码IE可以正常显示,但MF无显示
- 如何判断表格中行 checkbox 选中行里面 input 的值
- IE下两个客户需求,100分请高手帮助啊。
- javascript如何判断某安钮是否存在?
- 【JS高手群】
- 关于图片的按钮的问题,问题详细见帖中,多谢各位!
- 改变iframe的scrolling属性,浏览器为何不能作出相应反应??!!
- 帮忙看看这个效果!
- 想问大家一个javascript的问题,up有分。。。。。。。。。。
- javascript中怎么给一个数组追加数据?
for (i=1;i<=tRows;i++) { // tRows表示动态表格生成行数
a = eval("frm.txtNumber" + i + ".value");
b = eval("frm.txtUnitPrice" + i + ".value");
tv.push[a,b]; //这里的push怎么代替?
frm.txtTotal.value = updateTotal();
}
function updateTotal() {
var i, len = tv.length;
var total=0;
for (i = 0; i < len; i++) {
total += tv[i][0]*tv[i][1];
}
return total;
}
if(typeof(Array.prototype.push)!="function")
{
Array.prototype.push = function()
{
for (var i=0; i<arguments.length; i++)
this[this.length] = arguments[i];
return this.length;
};
}tv.push(a, b);
sorry, 应该是 tv.push([a,b]) 我写成了 tv.push(a,b)
不是组织其实上例中的tv.push(a,b)等于tv.push(frm.txtNumber1.value,frm.txtUnitPrice1.value);
tv.push(frm.txtNumber2.value,frm.txtUnitPrice2.value);
tv.push(frm.txtNumber3.value,frm.txtUnitPrice3.value);
.
.
.
tv.push(frm.txtNumber n .value,frm.txtUnitPrice n .value);