views:

361

answers:

4

I've got a JScript error on my page. I know where the error's happening, but I'm attempting to decipher the JScript on that page (to figure out where it came from -- it's on an ASPX page, so any number of user controls could have injected it).

It'd be easier if it was indented properly. Are there any free JScript reformatters for Windows?

A: 

How about if you just run Firebug, it will tell you what the error is and will take you to where it is.

Tools like phpDesigner (there's a free trial) have a code beautifier that will work on JavaScript, but nothing beats the good old TAB key (and shift tab to remove junk indention) :P

TravisO
+1  A: 

You really should use Firebug or some similar debugging tool to actually find the problem, but, if you want to just format your JavaScript code, here's a reformatter I found on Google.

Unniloct
A: 

Use Visual Studio 2008

  1. Create a new Web-Form
  2. Paste your js code in the source
  3. select-all (ctrl + a)
  4. right click to open the context-menu
  5. Click on Format Selection

The js and html will then be formatted accordingly

Andreas Grech
Doesn't work for me (in VS2008 Developer). Doesn't work in a .JS file, or in a .ASPX file.
Roger Lipscombe
It works in an aspx page...I use it all the time actuallyIt also indents the code when you terminate a line with a ;
Andreas Grech
+1  A: 

You can use Aptana Studio, its free and really good, and you can customize your formatting preferences.

CMS