Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 887 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Response.write vs Document.write

#1
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.

Reply

#2
Yes capitalization does matter. VB tends to lean towards pascal casing for methods, so `.Write()` would be correct in vb. But `.write()` would be correct in javascript. If it is a predefined function that is.

No everything inside the <% %> tags would not be considered javascript, it would be considered asp.
Reply

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

If they all work, then I would suggest to just pick one and go with it. Though, I remember reading that you should not use `document` on the server side.

No, you don't have to worry about the capitalization in vbscript. It really comes down to personal preference. I like to use `Response.Write()` myself, but I've seen `response.write` littered throughout source code as well.

**Methods with parentheses vs methods without parentheses.**
The difference is the type of method. Vbscript supports `sub` and `function` methods. A `sub` is used when no data is meant to be returned and a `function` is used when data is to be returned. A `sub` method takes it's parameters without parentheses (the server will complain if you try to call a `sub` with parentheses and more than one parameter). A `function` takes it's parameters with parentheses. Don't ask me why the creators chose to do it this way, it annoys the heck out of me.

JavaScript can be used on the server with classic asp. It actually can come in handy if you are wanting to pass JSON around

[To see links please register here]

.
Reply

#4
You can use [VBScript][1] or [JScript][2] as your language when writing classic ASP server-side code.

From [Wikipedia][3]:

> 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.

[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through