JavaScript Surface Object Design _js Object oriented

Source: Internet
Author: User
NEW: string equality comparisons in JavaScript
The application of the image object is quite extensive, it appears in the desktop programming very early, the application is more mature, like c++,java,c# etc. And in the Web programming this piece, appear much later, so that the current web development is difficult, of course, there are many technologies involved in web development reasons. In recent years, object-oriented gradually introduced in web development. Many large web sites are developed in PHP, PHP 4 is not perfect object-oriented, in PHP 5 improved. NET is also object-oriented, but execution efficiency is not as efficient as PHP.

JavaScript is also used quite a lot in web development, and most of the form validation is done with it. JavaScript as a scripting language, there is no special IDE development environment, there is no good debugging tools, development is rather slow, has not been the attention of people. It was not until the advent of Ajax that it brought life to it. It also gives people a real glimpse of the effect it brings with other technologies.

JavaScript is a part of the object that contains the image, but it is not popularized in the application.

Look at a simple example:

Define CTest class//Ctest.js
function CTest ()
{
This.m_sstr = "";
This. Input = Ctest_input;
This. Output = Ctest_output;

function Ctest_input (str)
{
This.m_sstr = str;
}
function Ctest_output ()
{
alert (THIS.M_SSTR);
}
}
Use method <!--ctest.html-->
<script type= "Text/javascript" src= "Ctest.js" ></script>
<script type= "Text/javascript" >
var g_ctest = G_ctest = new CTest ();
G_ctest.input ("hello! Welcome to my blog! ");
G_ctest.output ();
</script>

Is it very much like C + +, it is more convenient to use it.

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.