Write client-side javascript function to convert ampersands

Assignment Help Programming Languages
Reference no: EM1361620

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

Reference no: EM1361620

Questions Cloud

Finance based decision making question : Benson Corporation is evaluating option uses for a three-story manufacturing and warehousing building that it has bought for $225,000.
Show long-term business objectives : Estimate the sustainability of long-term business operations and describe how the global market affects business strategy.
Sustainability and environmental issues : Explain how these decisions enable the organization to avoid violations in terms of environmental issues.
Telephonic or disease management programs : Do you consider telephonic or disease management programs that assign nursing personnel a patient population to serve, useful? Under which circumstances do you think these programs would be useful?
Write client-side javascript function to convert ampersands : 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.
Show public employees liability for constitutional torts : Hypothesize a situation in which a public administrator or employee should have the constitutional right to disobey a directive ordered by a superior.
Strengths=weaknesses in japanese management-health care : I need help discussing three strengths and three weaknesses in Japanese management, as it would pertain to health care.
Business self-regulation : Should the issue be resolved through legislative action, global treaties, executive agency regulation or business self-regulation? Why?
Find entropy change of the horseshoe-plus-water system : If so how fast will the cars be traveling when they collided? If they did not, what is a distance between the cars at this point.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create design of very simple racing game

Create a very simple racing game of your own design. Making a game from the ground up is a lot of effort, so let's keep things basic.

  Designing class to denote person-s height

Design a class, PersonHeight, to denote the person's height. Our class will include the following members.

  Creating code for method tostring

Fill in the code for method toString, which must return a string containing the name, account number, and balance for the account.

  Create a new console application project

Create a new console application project and name it "Week1Lab_BirdN". Create the necessary member functions that will perform the required operations outlined in the lab summary above.

  Communicate with a pc using the rs232c serial protocol

In this assignment we will use the UART0 peripheral to communicate with a PC using the RS232C serial protocol.

  Application to inputs five numbers given between a range

Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display it only if it's not a duplicate of a number already read.

  Write program two functions to solve problem of university

Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members.

  Program to display contents of file in separate line

Display the contents of the file GRADES created in Problem 1. Each student's record should appear on a separate line and include the total score (the sum of the three tests) for that student.

  Computing average net profit per sale of product

Your company bought 250,000 online advertising impressions and made average net profit per sale of product of $5.

  Writing program of long term parking

Write an enitre program about the long term parking, and calculate the parking total fare.

  Explaining class definition of subclass of square

Write down the class definition of subclass of Square called FancySquare which has a method called getDiagonal. The getDiagonal method gets no arguments.

  Develop pseudo-code for program to retrieve bytes

Develop the pseudo-code for a program that will retrieve 2 bytes (NUM1 and NUM2) from memory, determine which is closest to the numeric value 50.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd