Question: uestion #3 You have a server-side script that cannot handle any ampersand (&) and pipe character (I) in the form data. So we need to

 uestion #3 You have a server-side script that cannot handle any

uestion #3 You have a server-side script that cannot handle any ampersand (&) and pipe character (I) in the form data. So we need to convert all the ampersand characters to "and" and pipe characters to "or" at the client side. Write a script to do these conversions in the form field when the field loses focus element (blur). A) Your script (AmpersandPipe.js) contains one (01) variable and two (02) functions: 1. Global variable: dom. 2. The function getElementAmpersandPipe() first reads the field element by using the existing function getElementByldl to access the element using its id (field" specified in your HTML file. Then it uses the addEventlistener function to register the event handler. addEventListener) takes (03) arguments (a) the name of event as a string literal (here use "blur"), (b) the handler function convertAmpersandPipe, and (c) the Boolean value false. Computer Science & Software Engineering Concordia University 1-Winter 2019 Assignment 3 SOEN 287: Web P 3. The function "convertAmpersandPipe()" that converts all the ampersands in the form field to "and "and all the pipe characters to "or", when the field loses focus ("blur" 4. The html document called "AmpersandPipe.htm", which includes the "AmpersandPipe.js" in the head section. B) At the end of the JavaScript file, finish with this line to fire the load event when a resource and its dependent resources have finished loading: window.addEventListener "load", getElementAmpersandPipe, false ); Sample User Input: Emter some text that includes at least one ampersand "&"and ome pipe sign"" then click outside the input box Holo & choose ABIC & D Result: Sample Out Enter some text that includes at least one ampersand"& and one pipe sign"then click outside the input box Hello& choose AlB C & D Result: Hello and choose A or Bor C and D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!