![]() The task of displaying this information to the user remains.Ě requirement for cgi/perl programs served from the Princeton domain is that they must return a value to the user. 3.1.4: Parsing and Displaying the retrieved dataPerl has superior parsing and regular expression capabilities that make extracting the translation from within the � tags in the HTML string straightforward. This HTML is prefaced with information about the connection, the page�s server and content type. Perl does the necessary manipulations to this string (formats the URL for the cgi-query) and forms a socket connection to the translation site.3.1.3: Retrieving the data from the dictionaryOnce a socket connection is established, a simple loop in the Perl program funnels the HTML into a string. Clicking the Translate button triggers the communication chain and the Perl program receives the word contained in the text field. The measure to guard against unintentional word-fragment selection could now be over-ridden if the user truly desired to translate a modification of a word, as the text field is editable. The design decision to show the text field rather than hide it was made because it resulted in increased functionality. The value of the text field is set to the highlighted word as soon as the word is recognized. Figure 5: The Translate formWhile mouse events trigger the program to identify a highlighted word, the explicit click of a button by the user is necessary to prompt a connection to the database. ![]() The interface incorporated an HTML form which included a Translate button and a text area (Figure 5). We changed the design in order to meet these requirements. In order for the Perl program to be able to access the word, it must be contained in an HTML form, whose associated action is the program call. The Perl program receives the word as a parameter and manipulates it so that a connection can be established with the dictionary. 3.1.2: Sending the word to a web based dictionaryThe Perl program is the communication medium between the HTML page and the online dictionary. ![]() x.expand("word")This is a measure to guard against user errors. The code expands the highlighted selection so that a word will always be considered for translation in its entirety. The script checks whether a word has been highlighted on the page, grabs the text using the Range method, and stores it in a variable: Set x = VBS code not only grabs the highlighted text, but it also deals with the possibility of the user highlighting word fragments. HTML BODY HERE The implementation of this step is a function which is activated by a series of Mouse_up, Mouse_down, and Mouse_move events.
0 Comments
Leave a Reply. |