Click to See Complete Forum and Search --> : Printing out all form variables (Javascript)


axys
06-22-2005, 12:54 PM
I've inherited some ASP code written in Javascript and I'm trying to debug it. I want to print out all the form variables that arrive at a page. With Vbscript I would do:

For Each item in Request.Form
Response.Write Request.Form (item)
Loop

Does anyone know how I can do this in Javascript?

Cheers

buntine
06-23-2005, 01:47 AM
JScript does not have support for the For...Each loop. You can, however, use the For...In loop which implements a similar syntax (or rather a C-Based equivelant).

for (var item in Request.Form)
Response.Write (Reqest.Form(item))

Be aware that these two loops work slightly different. For...Each enumerates the items of a collection, whilst For...In enumerates the properties of an object. But nonetheless, give that a shot and see what happens.

Regards.