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

  Program to create professor rating class

Write down program to create Professor Rating class comprising of professor ID and three ratings. Three ratings are utilized to estimate easiness.

  Write a trigger for total percentage of all appointments

Write a trigger on Works department to ensure the following requirement; the total percentage of all appointments for an employee must be fewer than 100%.

  Writing code in client program to enter score

Write down code in a client program to perform the following: prompt user to enter score and set score data member for player1.

  Writing class containing two instance variables

Write class named ParkingMeter containing: two instance variables named timeLeft and maxTime of type int. Value of timeLeft must be initialized to 0.

  Php script to obtain url and its description from user

Write a PHP script to obtain URL and its description from user and stores information into database by using MySQL.

  Historical principle for loss to the company is minimal

A colleague of yours frequently takes small amounts of office supplies, noting that the loss to the company is minimal. Your rationale expresses which historical principle?

  Design and write a payroll program

Design and write a payroll program that will prompt the user to enter an employee's hourly pay rate and the number of hours worked.

  Generate an object-oriented design for a system

Generate an object-oriented design for a system that keeps tracks of your CD and DVD collection. Identify each of the classes, associated data, and operations for the classes.

  Design a benefits election system

Individual project for this course is in form of Service Request from Huffman Trucking. It is essential for student to access Service Request: SR-ht-001. Design a Benefits Election System.

  Design program to ecode message using caesar cypher

Design a program which decodes messages. Messages will be encoded using Caesar cypher, with each letter being decoded by replacing it with previous letter in alphabet.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Create logic for application for user for order information

Create the logic for an application that continuously prompts a user for order information until the user enters "ZZZ" for the customer name or 10 orders.

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