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

  Demonstrate ascii code conversion

Develop a program for the PIC 16F84A using the MPLAB v8 IDE (MPLAB IDE v8.86) simulator software - Demonstrate the use of subroutines, e.g. initialize the peripheral registers and to set the time delays, etc.

  Test a class that prints william on the screen

Write down compile, and test a class that prints William Nichols, 777 Mockingbird Lane, Detroit MI 48222 on three separate lines on the sceen. Sace as Address.java

  Explain why to implement a queue using a linked list

Explain why, to implement a queue using a linked list, it is recommended to extract nodes from the top of the list and insert nodes at the tail of the list.

  Create a data frame that is equivalent to the sas data

Read in Traffic.dat using R and create a data frame that is equivalent to the SAS data set you created during the week.

  Why is selection sort stable- insertion sort why or why not

A stable sort does not change the order of elements with the same value. Why is selection sort stable? Insertion sort? Why or why not?

  Questionassume we have three classes alarmclock beeper and

questionassume we have three classes alarmclock beeper and alarmwindow. in following you see an interaction showing an

  How much of each chocolate type they produce for a given

The data indicates the batches of chocolates made each day and is described as the type of chocolates produced and the number of pieces in each batch.

  What is a multi dimensional arrays

Why are there so iterative structures and what is the purpose of each. Think about looping and why different ones exist and why you can't have just one.

  Briefly explain the difference mesh, bus, ring, and star top

Briefly explain the difference, including advantages and disadvantages Ethernet, Token Ring, FDDI, and Wireless.

  What are the expected signs

The cig consume dataset contains 48 states annual data for 1985-1995. Fit an FE model of demand for cig consume packpc. as a function of price (agars).

  Perform a direct construction

Give a regular expression for each of the subsequent languages by performing a direct construction.

  Short paper on your servers performance

A solid amount of statistics, you should write a short paper on your server's performance. Point out bottlenecks and analyze the data that you've gathered, as well as coming up with a few suggestions on how you may be able to increase performance

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