First look at the code that simulates the Click event:
Copy Code code as follows:
<a href=http://www.jb51.net target= "_blank" id= "AA" >ok</a>
<script>
var comment = document.getElementById (' AA ');
if (document.all) {
Comment.click ();
else {//Firefox, if the onclick event is not defined in <a>, this paragraph does not work for Firefox
var ev = document.createevent ("mouseevents");
Ev.initevent ("Click", True, true);
document.getElementById ("AA"). dispatchevent (EV);
}
</script>
In fact, I am in the page to trigger a click event in order to submit the form, in the form of a new window open, we often ignore some basic knowledge,<form> actually has provided this function,
It's just that we forgot about it.
Copy Code code as follows:
<form action= "/shopping/index" method= "post" id= "ProcessOrder" target= "_blank" onsubmit= "return Checkorder ()" >
<input name= "Button2" type= "Submit" id= "Button2" "value=" "class=" Ck_lijisn "/>"
</form>
Such code can be completed in a new window submission, but note that buttons cannot be button if you use document.getElementById ("ProcessOrder") in the program. Submit () is not implemented
Submitted in a new window. Oh.
It seems that sometimes things are still good in tradition.