function getFormValues(fobj)
{
var str = "";
var valueArr = null;
var val = "";
var cmd = "";
var elemvalue = "";
var elemlength = fobj.elements.length;
for(var i = 0;i < elemlength;i++)
{
//alert("ELEMENT TYPE " + i + " " + fobj.elements[i].type);
//alert("ELEMENT VALUE " + i + " " + fobj.elements[i].value);
//alert("ELEMENT NAME " + i + " " + fobj.elements[i].name);
var elemtype = fobj.elements[i].type;
var elemname = fobj.elements[i].name;
if(elemtype=="text" || elemtype=="textarea" || elemtype=="hidden")
{
elemvalue = fobj.elements[i].value;
str += elemname + "=" + encodeURIComponent(elemvalue);
if(i!=elemlength)
{
str += "&";
}
}
else if(elemtype=="select-one")
{
elemvalue = fobj.elements[i].options[fobj.elements[i].selectedIndex].value;
str += elemname + "=" + encodeURIComponent(elemvalue);
if(i!=elemlength)
{
str += "&";
}
}
else if(elemtype=="checkbox")
{
elemvalue = fobj.elements[i].checked;
str += elemname + "=" + escape(elemvalue);
if(i!=elemlength)
{
str += "&";
}
}
else
{
}
}
str = str.substr(0,(str.length - 1));
return str;
}
posted on 2006-04-03 14:27
汪杰 阅读(271)
评论(0) 编辑 收藏 引用 所属分类:
hengxing网站js