Recently, I am doing a project, let go of what I am familiar with, starting with Java ... Maybe contact and gradually be familiar with new technologies, is a happy thing, but I gave me the biggest biggest in my work. Java. Not hibernate, but the scripting language I have neglected before - JavaScript. For the preferences of the script, it is, for example, Perl, such as PHP, all I like it very much ... But I never thought I would like JavaScript, and I never thought that this is used everywhere in the browser. Also brings a variety of client scripts, which will be so powerful and full of charm. I used to always feel that JavaScript is just a simple and some confusing script. In addition to adding some "small special effects" that can show off from the web page, it is not a lot of interpretation of the "small special effect", and this seemingly convenient interpretation language will also The browser version has a variety of compatibility issues. The procedure written by JavaScript is free of HTML, which also brings a variety of problems, and it is difficult to read, it is difficult to debug. However, this period of time because of work needs, it has to be used to design some small interactions, rather than searching for the existing code directly on the network as before. So I started writing procedures, starting to observe, feel and use JavaScript from recently, with practical, and complicated the procedure, gradually, gradually, the beginning of the complaints, and then admitted to the shot, did not expect Under this seemingly confusing script, there is such a rich connotation and so powerful and full of charm. In practice, I really learned how to use JavaScript, I know as a script, she is not confusing and simple, how her charm is present, depending on how people use it. In fact, as a script, her features are quite close to those powerful senior languages. She is even fully supported in form good OOP, enabling inheritance and polymorphism, enabling event drive model, can be used, and XML / DOM can be implemented well. If we can develop with excellent patterns and excellent methods, we can use JavaScript to write a very beautiful program code to achieve very powerful features. Using her ability to interact with Applet, it can even develop a perfect application with graphical interaction function! If you add Perl to make up for the defects of the client script read and write files, JavaScript will become a perfect development language. How can she perform, depending on how you use: / * formDemo.js * /
Function Form1 () {// private: form1.prototype.text = "formdemo" form1.prototype.client = function () {
} Form1.prototype.client.width = "600px" Form1.prototype.client.heigth = "440px" Form1.prototype.button1 = self.button1; this.button1.value = "OK"; this.button1.οnclick = button1_Click Form1.Prototype.Button2 = self.Button2; this.button2.value = "ca Zan"; this.button2.οnclick = button2_click; self.opener = self; Form1.Prototype.formLoad = function () {Alert ("Hello World (" Hello World ^^! ");} Self.formDemo.onload = this.form1_click ()} function button1_click () {Alert (" ok ");} function button2_click () {self.close ();}