![]() |
ASP beginner’s tutorial |
PART FOUR |
|
Using ASP |
|
OK, I’m bored, now show me some code!One of the standard introductory bits of code used by almost every introduction to anything is the “hello world!” routine, so lets get that out of the way quickly! The HTML/VBScript you might use is:
Try this using the demonstration file: hello.asp The Response.Write method outputs the text “hello world” to the web page and this processed by the server and delivered to your browser as:
You can see that all the script bits have “disappeared” and a normal HTML page appears. (Run the demonstration file and then view the source code). Why is that so special?You are right! This could have been better achieved using a static page. However, this is not an example that shows the power of ASP. What about showing the current date? This is not possible using a static page unless you physically change the page every day. However, you can automate this process using ASP: The HTML/VBScript you would use is:
The resulting web page could be:
Try this using the demonstration file: today.asp The only thing to bear in mind is that the date (or time) will be that of the server and not the client. This could cause a problem if your server is in London and your client is in Bombay! This type of functionality is perhaps better provided using client-side scripting. |
|
| Next: some more useful ASP | |
| © 2005 | Index: Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 |