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

  Write a c program to simulate a falling object

Write a C program to simulate a falling object. The program should ask for the initial height of the object, in feet.

  When does quicksort work best and when does it work worst

When does quicksort work best, and when does it work worst? Write a recursive procedure to implement the insertion sort algorithm.

  Implement an assembler for a hypothetical computer

You are required to implement an assembler for a hypothetical computer called TMIPS. Details regarding TMIPS are discusses at the end of the handout. You may choose a 1-pass or 2-pass design

  What is the flip flops

Using the following state table, derive the output sequences for the input sequence shown below, with the starting states as A, B, and C.

  Perform password cracking on wireless passwords

What is the value for a network or security administrator to perform password cracking on wireless passwords on their own network?

  Write a program that asks the user to enter his-her weight

Your weight is actually the amount of gravitational force exerted on you by the earth.

  Show that any n-node binary tree can be convert to any tree

Show that any n-node binary tree can be converted to any other n-node binary tree using O(n) rotations.

  List advantages of using spreadsheets for decision modeling

List some advantages of using spreadsheets for decision modeling. What is implementation, and why is it important?

  Write a program that populates an array named weekday

Write a program that populates an array named weekday from the string Sun Mon Tue Wed Thu Fri Sat, and then prints each day in uppercase.

  Different areas of the web infrastructure

Discuss at least three different areas of the web infrastructure that are important to secure - how far would you go from an ethical and biblical point of view

  Write the identity for the opt value

Give a dynamic programming for determining the most happiness you can generate for your clients by splitting your m hours among the n projects.

  Create and implement insertion sort algorithm

Create an array that holds 100000 random integers between 1-100000. Allow the user to enter an integer to search.

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