Web Technology Slip 8

 Q1. Write a java script program to accept a string and character from user and check the count of occurrences of that character in string.

Answer : 

<!DOCTYPE html>
<html>
   <body>
      <script>
         function displayCount() {
            setTimeout(function() {
               var str = document.getElementById('str1').value;
               var letter = document.getElementById('letter1').value;
               letter = letter[letter.length-1];

               var lCount;
               for (var i = lCount = 0; i < str.length; lCount += (str[i++] == letter));
               document.querySelector('p').innerText = lCount;
               return lCount;
            }, 50);
         }
      </script>
      Enter String: <input type="text" id="str1"><br><br>
      Enter Letter: <input onkeypress="displayCount()" type="text" id="letter1"><br><br>
      <button onclick="displayCount()">Click for Result</button><br><br>
      result= <p></p>
   </body>
</html>


Q2. Create HTML page with following specifications  i) Title should be about your self. ii) color the background should be pink. iii) Place your name at the top of page in large text and centered. iv) Add names of your family members each in different size, color, style       and font. v) Add scrolling text about your family. vi) Add any image at the bottom. (Use internal CSS to format the web page) 

Q1. Write a java script program to accept a string and character from user and check the count of         occurrences of that character in string.

Answer : 

<html>
<head>
<title>My Self</title>
</head>
<body bgcolor="pink">
<h1 align="center" style="color:blue; font-family:arial; ">Enter Your Name</h1>

<p style ="font-family:Albertus Extra Bold; color: #FF7F50 ; font-size:20;" >Enter Your Name</p>

<p  style ="font-family:Lucida Console; color:#FF4500 ; font-size:12;" >Enter Your friend Name</p>

<p  style ="font-family:Bahnschrift Light SemiCondensed; color:#228B22; font-size:15;" >Enter Your friend Name</p>

<p  style ="font-family:Bodoni Poster; color:#2E8B57; font-size:14;" >Enter Your friend Name</p>

<p  style ="font-family:Chicago; color: #00FFFF; font-size:22;" >Enter Your friend Name</p>

<p  style ="font-family:Copperplate33bc; color: #008B8B; font-size:25;" >Enter Your friend Name</p>

<p  style ="font-family:GillSans ExtraBold; color:#7B68EE; font-size:26;" >Enter Your friend Name</p>

<img src="1.jpeg" style="height:50px; width:500px; align:center;">

<div id="footer" >copyright@2020 Design By Enter Your Name </div>
</body>

</html>

Web Technology Slip 8 Web Technology Slip 8 Reviewed by technical_saurabh on December 21, 2020 Rating: 5

No comments:

Powered by Blogger.