Use the jquery implementation to post to open a new window

Source: Internet
Author: User
Tags commit

  Network already has this function function, is a pure JS implementation, this article introduces the use of jquery implementation, the need for friends can refer to the following

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 .    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 ';  code as follows:/**  * jquery implementation   @param that opens a new window as a post form: URL needs to open url  @param: args URL parameters, the data type is object  @param: Name opens the URL window, If the same button needs to repeatedly open a new window,  instead of refreshing it on the first open window, this parameter should be different each time   @param: Windowparam The parameter configuration of the new open window   * @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]}); }   //Clone window Parameter Object   var windowconfig = Clone (windowdefaultconfig);   //Configuration window   for (var i in Windowparam) {  windowconfig[i] = windowparam[i]; }   //window configuration string &nbs P var windowconfigstr = "";    for (var i in windowconfig) {  windowconfigstr + = i+ "=" +windowconfig[i]+ "; &nb Sp }   //Binding Commit trigger Event   _form.bind (' Submit ', function () {  window.open ("About:blank", name, WINDOWCONFIGSTR); });   //Trigger Commit event   _form.trigger ("submit"); //form deletion   _form.remove ();  }    Record down, later can use.    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.