Write a javascript script that inputs several lines of text

Assignment Help Computer Engineering
Reference no: EM132201151

Write a JavaScript script called "CharacterOccurences.JS" that inputs several lines of text and a search character and uses String method indexOf() to determine the number of occurrences of the character in text.

A) You have to use the external CSS file called "CharacterOccurences.CSS" to set the margin of the paragraph to the value 0 (zero).

B) You have to declare in your HTML form four (04) ids :

a. "searchString" as textarea id in paragraph with 4 rows and 55 columns

b. "characters" as input id in paragraph with text type and size equal 5

c. "searchButton" as input id in paragraph with button type and its value equal "Search"

d. "output" as id in paragraph is for the final result.

C) The JavaScript file (CharacterOccurences.js) contains three (03) global variables and two (02) functions:

a. Global variables :

i. searchStr to get the id of "searchString"

ii. ch to get the id of "characters"

iii. outResult to get the id of "output"

b. The function getAllDomElement() that

i. Accesses the "searchButton" element and adds the search button using its id by using the existing the function addEventListener(), which takes three (03) arguments: (a) the name of event as a string literal (here is "click"), (b) the function searchOccurrences, and (c) the Boolean value false.

ii. Gets all id elements of "searchString", "characters", "output" using the existing function getElementById()

c. The function searchOccurrences() to search the character we look for and count the number of occurrences of that character.

i. 4 local variables: count, chValue, searchStr, result.

ii. Use the functions: charAt( 0 ), toLowerCase() and indexOf().

iii. If the variable count equal 0 (zero) display the message: the character ch not found. Otherwise display the result.

D) 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", getAllDomElement, false );

Reference no: EM132201151

Questions Cloud

Discuss the trade-off that liam is making : Liam O' Kelly is 20 years old and is thinking about buying a term life insurance policy with his wife as the beneficiary. The quoted annual premium for Liam.
Write a line of code to dynamic ally allocate an array : Write a bit of code that would resize the array from (a) to be twice its current size, meanwhile preserving the contents.
What are the critical values : Assume the amounts are approximately normally distributed. What are the critical values you should use to test the given hypothesis?
What is the equation that depicts the combination of payment : What is the equation that depicts the combination of payments required to cover the salary the EXECUTIVE could receive at the market rate and the cost borne.
Write a javascript script that inputs several lines of text : 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.
How much would john be prepared to pay for full insurance : In another scenario, he has a utility function over wealth; U = W1/14. He is looking for insurance to cover his loss if robbery occurs.
Display the mouse point location with proper labels : Write an JavaFx program, MousePoint, that displays the mouse point location with proper labels when the mouse is pressed in the pane.
Make a diabetes prevention program tailored : A local clinic is trying to make a diabetes prevention program tailored to their patient population. Two major factors to preventing and controlling diabetes
Ask the user to enter an input file name : Write a java program that would ask the user to enter an input file name, and an output file name.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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