Javascript asp tutorial Lesson 3 new String () constructor

Source: Internet
Author: User

Start:
New String () is another strange appearance in this course plan. Like escape characters, new String () is a required element for creating a successful asp javascript Application. The following are two scripts for this course:

The following is a script that actually bears the weight:

New String () in the action ():
Now let's take a look at the following asp line.
Request. Form we will have separate courses to teach later. The following is the focus of our discussion. The data held in request. form (from user data) is not a javascript data type. On the contrary, it is an asp local data type. Javascript cannot process asp data types. The solution is to convert the asp data type to the javascript data type. In this example, the new string () constructor is used.
Quick notes:
If you want to output the text from request. form to the user again, you do not need new string (). But if you want to use a javascript function or method to process the text, you must use new string ().
No new string ():
Let's take a look at the rows I typed below:
Var WebPageVariable = Request. Form ("WebPageVaraible"). toUpperCase ();
Error! The above row will throw an error because Request. Form ("webpagevaravisible") is an asp object, and toUpperCase () is a javascript method.
Forward:
Since we have escape characters and new string (), everything in asp javascript seems much simpler.
You only see the tip of the iceberg. We can mix and match functions and methods of javascript and vbscript. Vbscript and javascript Functions can pass parameters before and after each other. They can be perfectly combined. This will be part of the fourth lesson.

Original article and example address: http://aspjavascript.com/lesson03.asp
Author: James Clark

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.