Javascript – Response.write vs Document.write

asp-classicjavascriptjscript

Inside a classic asp page, I'm told that you can use vbscript or jscript. And jscript is just javascript.

So I'm not sure what the difference is between Response.Write, Response.Write(), response.write(), and document.write()

Does the capitalization matter, and sometimes I seem to see no parentheses after the method name, and sometimes I do. It's all devolving into a mess inside my newbie head.

If I'm writing classic asp using JScript (and not VBScript), should everything inside <% %> be considered javascript, just on the server side?

Prior to classic asp, I was sure that javascript was a client-side scripting language only.

Best Answer

You can use VBScript or JScript as your language when writing classic ASP server-side code.

From Wikipedia:

JScript is Microsoft's implementation of the ECMAScript standard that is used in Microsoft's Internet Explorer.

You can also use it in classic ASP, and it has some additional objects available (Response, Request, Application, Session, etc) so that you can do server-side web programming.

If I was required to write classic ASP, I would definitely choose JScript. Each language has its own syntax requirements that you will need to learn whichever you choose.

document.write() is not used server-side to send data back to the client, you always use the Response object for that.

If I'm writing classic asp using JScript (and not VBScript), should everything inside <% %>be considered javascript, just on the server side?

Depends on the context—generally the syntax is the same. Stick with Microsoft's JScript documentation and you'll be fine.

Related Topic