start:
You can make javascript and vbscript implementations transmit music from the same table. Check out the script below:
[Ctrl+A Select all Note: If you need to introduce external Js, you need to refresh to execute]
RUNAT:
Let's break it down from beginning to end. The following list is a simple and standalone javascript:
If it weren't for the inconspicuous RUNAT="Server", it would have looked like a simple javascript you might see on the client.
The RUNAT attribute tells the server to execute it on the server side, so the client will never see it. You can also set the property to RUNAT="client", so that you can skip the server and execute it directly on the client.
By the way, it cannot be placed inside the asp tag.
Take a look at the vbscript below:
FunctionVBGreeting()
VBGreeting="GreetingsfromVBScriptFunction"
EndFunction
This vbscript implements the same functions as javascript. It's nothing special.
However, there are some special features in the vbscript below.
FunctiontoDollars(x)
toDollars=FormatCurrency(x)
EndFunction
Quote:
The above function returns to get a parameter from javascript. Then he will return the most appropriate value to javascript. Let's see how FunctiontoDollars(x) is referenced.
functionadd(x,y)
{
result=x+y;
result=toDollars(result);
returnresult;
}
The function add(x,y) is a javascript function. You can see from the middle of the function
result=toDollars(result);
The line above is actually a call to javascript by vbscript.
warn:
As a warning. When you create a script with RUNAT attribute, you are actually scheduling the execution order. I won't explain this issue in depth, because the order of execution depends on the situation.
Here is what I will explain in depth: Use only RUNAT attributes for functions (and those global variables that are called within functions). Don't put the top-most code inside it, because you can't guarantee that the top-level code will change the execution order because of using this technique.
The original text and example address of this section: http://aspjavascript.com/lesson04.asp
Original author: James Clark Translation: huahua Please indicate the reprint