📄 asp_variables.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP Variables</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>ASP Variables</h1>
<a href="asp_syntax.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_procedures.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">A variable is used to store information. </p>
<p class="intro">If the variable is declared outside a procedure it can be changed by any
script in the ASP file. If the variable is declared inside a procedure, it is created and destroyed every time
the procedure is executed. </p>
<hr />
<h2>Examples</h2>
<p><a target="_blank" href="showasp.asp@filename=demo_variable">Declare a variable</a><br />
Variables are used to store information. This example demonstrates how to declare a variable, assign a value to it, and use the value in a text.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_array">Declare an array</a><br />
Arrays are used to store a series of related data items. This example demonstrates how to declare an array that stores names.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_fornext2">Loop through the HTML headers</a><br />
How to loop through the six headers in HTML.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_vbtime">Time-based greeting using VBScript</a><br />
This example will display a different message to the user depending on the time on the server.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_jstime">Time-based greeting using JavaScript</a><br />
This example is the same as the one above, but the syntax is different.</p>
<hr />
<h2>Lifetime of Variables </h2>
<p>A variable declared outside a procedure can be accessed and changed by any
script in the ASP file. </p>
<p>A variable declared inside a procedure is created and destroyed every time
the procedure is executed. No scripts outside the procedure can access
or change the variable. </p>
<p>To declare variables accessible to more than one ASP file, declare them as session
variables
or application variables.</p>
<h3>Session Variables</h3>
<p>Session variables are used to store information about ONE single
user, and are available to all pages in one application. Typically information
stored in session variables are name, id, and preferences.</p>
<h3>Application Variables </h3>
<p>Application variables are also available to all pages in one application.
Application variables are used to store information about ALL users in a
specific application.</p>
<hr />
<a href="asp_syntax.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_procedures.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -