How to open more then one new tabs in browser using javascript
To open no of new tabs in browser , We have to dynamically create forms on fly on any particular event like page load, on click etc.
//helper function to create the form function getNewSubmitForm(val){ var submitForm = document.createElement("FORM"); document.body.appendChild(submitForm); submitForm.method = "POST"; submitForm.target ="_BLANK"; submitForm.name ="frm"; submitForm.id = val; return submitForm; }Above function create form element and its set its attributes.
//helper function to add elements to the form function createNewFormElement(inputForm, elementName, elementValue){ //Create an input type dynamically. var element = document.createElement("input"); //Assign different attributes to the element. element.setAttribute("type", "hidden"); element.setAttribute("value", elementValue); element.setAttribute("name", elementName); inputForm.appendChild(element); return element; }This function set the hidden fields and value of form elements.
//function that creates the form, adds some elements //and then submits it function createFormAndSubmit(val){ var submitForm = getNewSubmitForm(val); createNewFormElement(submitForm, "act", "checkurl"); createNewFormElement(submitForm, "websiteId", val); submitForm.action= "test-url.php"; submitForm.submit(); return false; }Above function create form element and submit form.
function start(start,end){ for(var i=start;i<=end;i++){ alert(i); createFormAndSubmit(i); } }By giving start and end limit , we can create no of forms as per our requirements. We can you above function using this single function,it will invoke other functions automatically :
onclick="start(1,10)"
1 comments:
The casino casino hotel at Harrah's and the LINQ - Air Jordan
The casino hotel at Harrah's and the LINQ งานออนไลน์ Hotel super air jordan 7 retro in Las Vegas is Air Jordan 14 Retro the most 바카라 사이트 casinopan beautiful place to be if you're going to visit Wholesale jordan 20 retro the action at the
Post a Comment
Please provide your valuable comment.