![]() |
Mixing HTML and Script commands![]() ![]() ![]() ![]() ![]()
You can include within ASP delimiters any statement, expression, procedure, or operator that is valid for your primary scripting language. A statement, in VBScript and other scripting languages, is a syntactically complete unit that expresses one kind of action, declaration, or definition. The conditional If .... Then .... Else statement that appears below is a common VBScript statement.
<% <%= Greeting%> This statement stores either the value "Good Morning" or the value "Hello!" in the variable greeting. The < % = Greeting% > command sends the current value of the variable to the browser. Thus, a user viewing this script before 12:00 noon (in the Web server's time Zone) would see this line of text. Good Morning! A user viewing the script at or after 12:00 noon would see this line of text: Hello! You can include HTML text between the sections of the statement. For example, the following script, which mixes HTML within an If ... Then ... Else statement, produces the same result as the script in the previous example: < % If time> = #12:00:00 AM# And time < #12:00:00 PM # Then % > Good Morning! If the condition is true that is, if the time is midnight of after, and before noon then the Web Server sends the HTML that follows the condition ("Good Morning") to the browser, otherwise, it sends the HTML that follows Else ("Hello") to the browser. This way of mixing HTML and script commands ins convenient for wrapping the If...Then .... Else statement around several lines of HTML text. The previous example is more useful if you want to display a greeting in several places on your Web Page. You can set the value of the variable one and then display it repeatedly. Rather than interspersing HTML text with script commands, you can return HTML text to the browser from within a script command. To return text to You can include procedures written in your default primary Scripting language within ASP delimiters. If you are working with Jscripts commands, you can insert the curly braces that indicate a block of statements directly into your ASP commands even if they are interspersed with HTML tags and text. For example: M % if (Screen resolution = = "low") {%>
|
|
Domain NamesASP IDC and HTX Files Creating ASP Pages Adding Script Commands Mixing HTML and Script Commands ASP Directives Setting the Primary Scripting Language Using VBScript and JScript on a Server Variable Scope Session Scope Application Scope
Defining Procedures Calling Procedures Components ASP ApplicationsWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |