//helper function to create the form
function getNewSubmitForm()
{
var submitForm = document.createElement("FORM");
document.body.appendChild(submitForm);
submitForm.method = "POST";
return submitForm;
}
//helper function to add elements to the form
function createNewFormElement(inputForm, elementName, elementValue)
{
var newElement = document.createElement("input");
newElement.setAttribute("name",elementName);
newElement.setAttribute("type","hidden");
newElement.setAttribute("value",elementValue);
inputForm.appendChild(newElement);
return newElement;
}
//function that creates the form, adds some elements
//and then submits it
function select(id)
{
var t = document.getElementById("t" + id);
var d = document.getElementById("d" + id);
var submitForm = getNewSubmitForm();
createNewFormElement(submitForm, "name", t.innerHTML);
createNewFormElement(submitForm, "remark", d.innerHTML);
submitForm.action= "quote.aspx";
submitForm.submit();
}
转载自:http://www.cnblogs.com/angushine/archive/2008/07/20/1247223.html