How to implement the function of DOS in Data Enter the Ranking in DOS in the web page developed by VS.NET/C# Builder
Beijing Coal Scientific Research Institute Economics and Information Research Institute Ding Bao
In the DOS era, we are used to entry the data entry to the next line after entering the line after entering a line of data. The glory of the past DOS has become the past, and today, more friendly and easy-to-use GUI graphical operation interface Windows has entered our daily life.
In 1996, the emergence of Windows95 was a great revolution in the history of software. Windows is a graphical operating system developed by Microsoft. It has overcome some of the difficulties in DOS, so that the computer is more close to people, as long as you gently click the mouse, the computer will complete a action. At the same time, Windows also changed the way to enter the data knocker in DOS. Now we want the cursor to jump to the next line or the next input box when entering the data. You can only press the TAB button on the keyboard or click on the next input with the mouse. frame. This change has no big impact on the computer users who have not been exposed to the DOS operating system, but the computer users who turn over from DOS are a chicken rib; especially our data entry, in the DOS era, it is used to entry Tap the entry of the bus to continue the entry of the data. Can you care about these old users' habits is what our developers should consider.
The author has encountered such a problem in a short ago: the user requires our front desk to enter the page to provide the function of supporting the return line. Those who have been developing know that in the traditional Windows application, it is not too difficult to implement the carriage return. We can use the check-up key value by intercepting the keyboard, then make the next control in the interface (such as text). Box input box, etc.) Get this purpose to achieve the input focus. In the web page, we can also set the focus of the web control through a scripbook (JavaScript or VBScript) language.
In the web application written in traditional ASP or JSP / PHP, we usually do a JavaScript or VBScript in an incident in an onkeypress event, OnClick event or onSubmit in the control. The code captures the key value of the keyboard carriage return, then realizes the enterprise to the specified jump order, this method of drawing can only apply to the page control element very small items, once the page control element or this class file is much more This artificial way must consume great workload. Can you have a valid way to make us always? This is the content of this article to discuss. The officials are in an urgency, and I will come slowly:
Our project is developed with VB.Net, the front desk entry interface is the HTML page generated after the VB.NET program is compiled, and runs in the browser. The biggest benefit of VB.NET development is that the program code can be isolated from the interface, which is independent of each other; but the control element name in the HTML entered interface generated after the program developed by VB.NET is very difficult, though It will also have a certain naming rule. Before compiling, we are unable to learn the recorded control element name on the compilation generating page.
In this way, we have encountered a problem. Do you say that we have to realize the return of the ROM under DOS. Only open one of the ASPX files to view the element name, then press the ASP or JSP / PHP to write the corresponding JavaScript Did the VBScript code? This is obviously a faint fact; our project has hundreds of ASPX files, to open hundreds of files one by one by one by one in ASP or JSP / PHP, write JavaScript or VBScript Enter to implement code is simply anecdote. The author found the solution by checking MSDN and repeated practice.
Below I will use the JavaScript scripting language as an example to solve this problem. I have to introduce some related knowledge before writing the code; the page files browsed in the browser are in JavaScript as a document object (DOM). There is a few "big" objects in JavaScript: Window, Document, Location, Navigator, Screen, History, etc. The Window object is the parent object of Document, Location, and History objects. Focusing on the issues we have to solve, here we focus on the three objects of Document, Form, Elements, and onKeyPress events, Document Document Object: refers to the document describing the current window or the specified window object. It contains the content from
to body>. Usage: Document (Current Window) or