start:
new String() is another strange place that appears earlier in this lesson plan. But like escape characters, new String() is a necessary element to create a successful asp javascript application. Here are two scripts for this lesson:
Here is a script that actually bears the weight:
new String( ):
Now let’s take a look at the asp line below.
Request.Form We will have independent courses to teach later. The following is the focus we are going to talk about now. The data held in request.form (data from the user) is not a javascript data type. Instead, it is an asp local data type. JavaScript cannot handle asp data types. The solution is to convert the asp data type into a javascript data type. In this example, the implementation method is to use the new string() constructor.
Quick Notes:
If you want to re-output text from request.form to the user, then you don't need new string(). But if you want to use a javascript function or method to process this text, you must use new string().
No new string():
Look at the line I typed below:
var WebPageVariable = Request.Form("WebPageVaraible").toUpperCase();
mistake! The above line will throw an error because Request.Form("WebPageVaraible") is an asp object, and toUpperCase( ) is a javascript method.
go ahead:
Now that we have escaped characters and new string(), everything seems to be much simpler in asp javascript.
You actually only see the tip of the iceberg. We can mix and match javascript and vbscript functions and methods. vbscript and javascript functions can pass parameters to each other before and after. They can be perfectly combined. This will be what the fourth lesson will be about.
The original text and example address of this section: http://aspjavascript.com/lesson03.asp
Original author: James Clark Translation: huahua Please indicate when reprinting