I am getting form names & values using the following. How can I write the following using jQuery?

Code:
var options = '';
for (i = 0; i < document.formname.elements.length; i++) {
	var optionName = document.formname.elements[i].name;
	var optionValue = document.formname.elements[i].value;
	options += optionName+optionValue;
}
There is no practical purpose, just want to know if it is possible to write the following statements in jQuery.

Code:
document.formname.elements.length
document.formname.elements[i].name
document.formname.elements[i].value
Thanks for any ideas.