General discussion

Locked

VBScript Questions

By galahad04 ·
1. What does the % symbol do when using VBScript in conjunction with HTML?

2. If Visual Basic 6.0 and VBScript share (for the most part) the same syntax, why is that it is syntactically legal to run certain code outside of a procedure in VBScript, but the same code will not compile in VB 6.0 (VB 6 compiler gives an error saying code cannot run outside of procedure)?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

VBScript Questions

by nikki96 In reply to VBScript Questions

The '%' symbol is used to tell the parser that the following is to be interpreted as code (not html but script). It must be used with < and >. Opening tag is <% and closing tag is %>. They work rather like <script> and </script> if you are familiar with javascript at all, except they work at the server side instead of the browser side.

2. The short answer - because. :)

The long answer - script is different than compiled code. There is no "main" or start function/procedure in VBScript. The page itself is parsed, not compiled. This goes back to the <% and %> that tell the parser *what* to parse.
It is not legal to put a MsgBox in script most of the time either, because the server doesn't run a MsgBox, the client does, and VBScript isalmost always interpreted by ASP and a server, not the client's browser.
The real difference is that VB6 is compiled code that runs on a client the vast majority of the time and VBScript is usually run with ASP on a server that parses a page and passes it back to a client, which then interprets the response. All major differences in the syntax and structure in the two languages can almost always be traced to that reason.


HTH
Nikki

Collapse -

VBScript Questions

by galahad04 In reply to VBScript Questions

Thanks for the helpful info!

Collapse -

VBScript Questions

by galahad04 In reply to VBScript Questions

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums