Using JS to submit parameters create form forms in Firefox problems _javascript tips

Source: Internet
Author: User
Tags visibility
On a front-end page, you need to submit parameters via JavaScript, use JS to create form forms, and append the parameters into the form to submit the code as follows:
JS Code:
Copy Code code as follows:

Functionloadconfig (Gameurl,skinid) {
Vartemp=document.createelement ("form");
Temp.action= "${createlink (Controller: ' Mobileconfig ', Action: ' Beforelaunchconfig ')}";
Temp.method= "POST";
Temp.style.visibility= "hidden";
Varopt=document.createelement ("input");
Opt.name= "Gameurl";
Opt.id= "Gameurl";
Opt.value=gameurl;
Varopt2=document.createelement ("input");
Opt2.name= "SkinId";
Opt2.id= "SkinId";
Opt2.value=skinid;
Temp.appendchild (opt);
Temp.appendchild (OPT2);
Temp.submit ();
}

The feature was successfully run on both Chrome and Safari, but was not successfully submitted when using Firefox (17.0.1), and after research found that Firefox submitted a page form when it required a complete label for the page, that is JS Code:
Copy Code code as follows:

Functionloadconfig (Gameurl,skinid) {
Varpagediv=document.getelementbyid ("page");
Vartemp=document.createelement ("form");
Temp.action= "${createlink (Controller: ' Mobileconfig ', Action: ' Beforelaunchconfig ')}";
Temp.method= "POST";
Temp.style.visibility= "hidden";
Temp.name= "Loadconfigpage";
Varopt=document.createelement ("input");
Opt.name= "Gameurl";
Opt.id= "Gameurl";
Opt.value=gameurl;
Varopt2=document.createelement ("input");
Opt2.name= "SkinId";
Opt2.id= "SkinId";
Opt2.value=skinid;
Temp.appendchild (opt);
Temp.appendchild (OPT2);
Pagediv.appendchild (temp);
Temp.submit ();
}

Append the form form created here in the <body> tab, and then commit it.

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.