IE and firefox simulate the Click event and submit it to the new window to summarize of asp.net
- 2020-05-16 06:49:37
- OfStack
First look at the code that simulates the click event:
In fact, the main reason I triggered an click event on the page was to open the form as a new window when I submitted the form. The rest of us tend to ignore some basic knowledge. < form > It's already provided,
We just forgot about it.
This code can be completed in the new window submitted, but note that the button cannot be button, if you use document.getElementById ("processorder").submit() is not implemented
Committed in a new window. Ha ha.
It seems that sometimes things are as good as traditional.
<a href=//www.ofstack.com target="_blank" id="aa">ok</a>
<script>
var comment = document.getElementById('aa');
if (document.all) {
comment.click();
} else { // Firefox, if <a> Is not defined in onclick Event, this section does not work for firefox
var ev = document.createEvent("MouseEvents");
ev.initEvent("click", true, true);
document.getElementById("aa").dispatchEvent(ev);
}
</script>
In fact, the main reason I triggered an click event on the page was to open the form as a new window when I submitted the form. The rest of us tend to ignore some basic knowledge. < form > It's already provided,
We just forgot about it.
<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>
This code can be completed in the new window submitted, but note that the button cannot be button, if you use document.getElementById ("processorder").submit() is not implemented
Committed in a new window. Ha ha.
It seems that sometimes things are as good as traditional.