Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Create an HTML page with the following functionality
i. It should ask the user 2 inputs:
1. Enter a Sentence (any English sentence)
2. Enter a Letter (any letter from A to Z)
ii. On clicking on "Submit" button it should output the rest of the
sentence after the first occurrence of the letter in the sentence
iii. If the letter does not exist in the sentence, output -> "The letter does
not exist in the sentence".
iv. Example 1
1. Sentence: Hello World!
2. Letter: r
3. Result: ld!
v. Example 2
1. Sentence: Hello World!
2. Letter: o
3. Result: World1

What I have tried:

<pre>Create an HTML page with the following functionality
i. It should ask the user 2 inputs:
1. Enter a Sentence (any English sentence)
2. Enter a Letter (any letter from A to Z)
ii. On clicking on "Submit" button it should output the rest of the
sentence after the first occurrence of the letter in the sentence
iii. If the letter does not exist in the sentence, output -> "The letter does
not exist in the sentence".
iv. Example 1
1. Sentence: Hello World!
2. Letter: r
3. Result: ld!
v. Example 2
1. Sentence: Hello World!
2. Letter: o
3. Result: World1
Posted
Comments
Mike Hankey 14-Sep-22 7:13am    
We are more than happy to help if you try and get stuck but we don't do homework for others.
Member 15627495 14-Sep-22 22:18pm    
to interact with user by JS, there is : prompt();
var sentence = prompt("sentence : ");
var letter = prompt("letter : ");

var position = sentence.indexOf(letter);
var result = sentence.substring(position , sentence.length ) ;



you have all elements there to achieve
Mohit gupta Dec2022 25-Dec-22 3:18am    
please write the full html code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900