<%@ Page Language="c#" %>
<script runat="server">
string Global ="<br><u>Hello I'm a persistent global variable</u>";
void Page_Load()
{
message1.Text="";
message1.Text+= Global;
message1.Text+="<BR />Calling Function 1...";
Function1();
message1.Text+="<BR />Calling Function 2...";
Function2();
message1.Text+="<BR />Calling Function 1...";
Function1();
}
void Function1()
{
string Different = "<i>Hello I'm the variable Different in Function 1</i>";
message1.Text+= Different;
message1.Text+= Global;
}
void Function2()
{
string Different = "<b>Hello I'm the variable Different in Function 2</b>";
message1.Text+= Different;
message1.Text+= Global;
}
</script>
<html>
<head>
<title>Scope</title>
</head>
<body>
<asp:Label id="message1" runat="server"></asp:Label>
</body>
</html>
<script runat="server">
string Global ="<br><u>Hello I'm a persistent global variable</u>";
void Page_Load()
{
message1.Text="";
message1.Text+= Global;
message1.Text+="<BR />Calling Function 1...";
Function1();
message1.Text+="<BR />Calling Function 2...";
Function2();
message1.Text+="<BR />Calling Function 1...";
Function1();
}
void Function1()
{
string Different = "<i>Hello I'm the variable Different in Function 1</i>";
message1.Text+= Different;
message1.Text+= Global;
}
void Function2()
{
string Different = "<b>Hello I'm the variable Different in Function 2</b>";
message1.Text+= Different;
message1.Text+= Global;
}
</script>
<html>
<head>
<title>Scope</title>
</head>
<body>
<asp:Label id="message1" runat="server"></asp:Label>
</body>
</html>
3460

被折叠的 条评论
为什么被折叠?



