I'm trying to figure out how I can create javascript code in a bookmark that pulls the names and values from the form inputs in a loaded document.

In addition it would also be nice if the code knew which form has focus and just pulled the input names and values from that form.

I've been trying to figure it out, but the only portion I could get to work so far is:
Code:
javascript:(document.write(document.forms[0].elements[0].name))
I don't really know where to go from here. Writing javascript in a javascript:() seems to be different and beyond my level.

Any help would be appreciated. Thanks.