The function on the network already has this function, is realizes with the pure JS. However, it was found in the project that this function was not compatible with Firefox, and I rewrote this method.
Copy Code code as follows:
Default New Window Configuration
var windowdefaultconfig = new Object;
windowdefaultconfig[' directories ' = ' no ';
windowdefaultconfig[' location ' = ' no ';
windowdefaultconfig[' menubar ' = ' no ';
windowdefaultconfig[' resizable '] = ' yes ';
windowdefaultconfig[' scrollbars '] = ' yes ';
windowdefaultconfig[' status ' = ' no ';
windowdefaultconfig[' toolbar ' = ' no ';
Copy Code code as follows:
/**
* jquery implementation to open a new window as a post form
@param: URL needs to open URL
@param: args url parameter, data type Object
@param: Name opens the name of the URL window, and if the same button needs to open the new window repeatedly,
Instead of refreshing in the first open window, this parameter should be different each time
@param: Windowparam parameter configuration for new open windows
* @author: Haijiang.mo
*/
function Jqueryopenpostwindow (url,args,name,windowparam) {
Create a Form Object
var _form = $ ("<form></form>", {
' ID ': ' tempform ',
' method ': ' Post ',
' Action ': URL,
' Target ': name,
' Style ': ' Display:none '
}). Appendto ($ ("body"));
Add hidden fields to the form
for (var i in args) {
_form.append ($ ("<input>", {' type ': ' Hidden ', ' name ': I, ' value ': Args[i]}));
}
Cloning a window Parameter object
var windowconfig = Clone (Windowdefaultconfig);
Configuration window
for (var i in Windowparam) {
Windowconfig[i] = Windowparam[i];
}
Window configuration string
var windowconfigstr = "";
for (var i in Windowconfig) {
Windowconfigstr + = i+ "=" +windowconfig[i]+ ",";
}
Binding Commit Trigger Event
_form.bind (' Submit ', function () {
window.open ("About:blank", name,windowconfigstr);
});
Trigger Commit Event
_form.trigger ("submit");
Form deletion
_form.remove ();
}
Write it down and you can use it later.