Your job is to write a client-side JavaScript function that converts all ampersands in a form field to the text string " and " when the form loses focus on the textbox in question.
Your HTML form can basically contain one text field with the "id=myText" and the onblur event to call your JavaScript function
Create a JavaScript function named "conertit()" which will:
Store the string from the myText textbox into a variable name "myString"
Use a for loop to loop from zero to "i < myString.length"
Inside the loop, use an "if/else" statement to determine if the current character is equal to an "&" or not. You can use the "charAt(i)" string method to accomplish this.
If it is an "&" then concatenate the new text " and" to a variable named "newString", else, concatenate the current character from charAt(i) to the variable "newString".
Once the loop is over you will then assign "newString" back to the value of the "myText" textbox in the HTML form effectively replacing the content with the newly converted information