Search This Blog

Monday 29 November 2021

6. Create a webpage to convert a given text from uppercase to lowercase using JavaScript.

 <!--Create a webpage to convert a given text from uppercase to lowercase using JavaScript.-->

<HTML>

     <HEAD>

     <STYLE Type="text/css">

  input { height:25px; width:100px; color:blue}

  th { text-align:left;}

  </STYLE>

     <SCRIPT  Language="JavaScript">

function Convert()

{

if(( document.forms[0].elements[0].value != "" ) && 

document.forms[0].elements[0].value !=

document.forms[0].elements[0].value.toLowerCase() )

{

     document.forms[0].elements[1].value =

     document.forms[0].elements[0].value.toLowerCase();

}

else

     alert("Enter Text in UPPERCASE!");

}

     </SCRIPT></HEAD>

     <BODY TEXT=blue BGCOLOR=BEIGE SIZE=22>

     <CENTER>

     <H3>CONVERSION OF TEXT FROM UPPERCASE TO LOWERCASE</H3>

     <FORM>

     <TABLE bgcolor=gray>

     <TR><TH>Enter Text in UpperCase</TH>

     <TH><INPUT TYPE="text" NAME="upper" value="" SIZE=10></TH></TR>

     <TR><TH>Text in LowerCase</TH>

     <TH><INPUT TYPE="text" DISABLED NAME="lower" value=""  SIZE=10></TH></TR>

     <TABLE>

     <br>

     <INPUT TYPE="button" onClick="Convert()" value="CONVERT">

     <INPUT TYPE="reset"  value="RESET">

     </FORM>   </CENTER> </BODY> </HTML>

5. Create a webpage with two textboxes and command buttons to perform arithmetic operations and display the result in appropriate dialog boxes using JavaScript.

 <!--Create a webpage with two textboxes and command buttons to perform arithmetic operations and display the result in appropriate dialog boxes using JavaScript.-->

<html>

 <head>

  <title>Arithmetic Operations</title>

  <style type="text/css">

  input { height:25px; width:100px; color:blue}

  th { text-align:left;}

  </style>

 

 </head>

 <body bgcolor=beige text=blue>

 <center>

 <h1> <u>ARITHMETIC OPERATIONS</u></h1>

 <form>

 

 <table bgcolor=gray>

 <tr><th>Enter 1st Number</th><th><input type="text" size=10   name=text1></th><tr>

<tr><th>Enter 2nd Number</th><th><input type="text" size=10  name=text2></th><tr>

 </table><br>

 

  <input type=button value="ADD" onClick="add()">

  <input type=button value="SUBTRACT"  onClick="sub()"><br>

  <input type=button value="MULTIPLY" onClick="multiply()">

  <input type=button value="DIVIDE" onClick="divide()"><br>

 

 </form>

<script language="JavaScript">

function add()

{

     var result = eval(document.forms[0].elements[0].value) + eval(document.forms[0].elements[1].value);

     alert("SUM = " + result);

}

function sub()

{

     var result = eval(document.forms[0].elements[0].value) - eval(document.forms[0].elements[1].value);

     alert("DIFFERENCE = " + result);

}

function multiply()

{

     var result = eval(document.forms[0].elements[0].value) * eval(document.forms[0].elements[1].value);

     alert("PRODUCT = " + result);

}

function divide()

{

     var result = eval(document.forms[0].elements[0].value) / eval(document.forms[0].elements[1].value);

     alert("QUOTIENT = " + result);

}

</script>

 </center>

 </body>

</html>

4. Create a webpage to demonstrate the use of External Cascading Style Sheets.

 Code for “mystyle.css”:

body{

          background-color: orange;

          font-family:serif;

          color: blue;

          font-size: 26pt;

     }

 

h3{ color:blue; }

 

.M { color: Magenta; font-style:italic  }

.Y { color:yellow; font-style:bold }

.R { color:Red; text-decoration:underline }

 

ul {

      list-style-type: square;

   }

Code for “ExternalCSS.html”:

<HTML>

    <HEAD>

        <TITLE>External CSS</TITLE>

        <LINK  REL="stylesheet" HREF="mystyle.css">

    </HEAD>

    <BODY>

    <H3>Applying Styles using External Cascading Style

    Sheets</H3>

         

    <span class="M">This text is Italic and Magenta.</span><br>

    <span class="Y">This text is Bold and Yellow.</span><br>

    <span class="R">This text is underlined and Red.</span><br>

       <P>This list is applied with External CSS:</P>

        <ul>

        <li>Element1

        <li>Element2

        </ul>

    

    </BODY>

</HTML>

3. Create a webpage to display system date in the given format: Ex: 01 January 2016

<HTML>

     <HEAD><TITLE> Display Date </TITLE>

     <SCRIPT language="JavaScript">

          var months = new Array(12);

          months[0]= "January";

          months[1]= "February";

          months[2]= "March";

          months[3]= "April";

          months[4]= "May";

          months[5]= "June";

          months[6]= "July";

          months[7]= "August";

          months[8]= "September";

          months[9]= "October";

          months[10]= "November";

          months[11]= "December";

         

          function CustomDate(m_date)

          {

              var theday = m_date.getDate();

              var themonth = months[m_date.getMonth()];

              var theyear = m_date.getYear()+1900;

              return theday + " " + themonth + " " + theyear;

          }

     </SCRIPT>

</HEAD>

<BODY bgcolor=beige text=green>

<center><font color=blue><H1>Webpage to Display System Date</H1></font></center>

     <H1>Today is:</H1>

<font size=22 color=magenta>

<SCRIPT>

          document.write(CustomDate( new Date()));

</SCRIPT>

</font>

</BODY>

</HTML>

Tuesday 23 November 2021

6.Write a C Program to read percentage of marks and to display appropriate grade (using switch case)

 /*6.Write a C Program to read percentage of marks and to display appropriate grade (using switch case) */

#include<stdio.h>

void main()

{

     int percent;

     clrscr();

     printf("Enter Marks in Percentage:");

     scanf("%d",&percent);

     switch(percent/10)

     {

          case 10:

          case  9:

          case  8:

          case  7:printf("Distinction!\n");

              break;

          case  6:

              printf("First Class!\n");

              break;

          case 5: printf("Second Class!\n");

              break;

          case 4: printf("Pass!\n");

              break;

          default:printf("Fail!\n"); break; } getch(); }

5. C Program to read numbers from keyboard continuously till the user presses 999 and find sum of positive numbers.

 /*5. C Program to read numbers from keyboard continuously till the user presses 999 and find sum of positive numbers. */

#include<stdio.h>

void main()

{

     int num, sum=0;

     clrscr();

     while(1)

     {

          printf("Enter any number:");

          scanf("%d",&num);

          if(num>0 && num!=999)

          {

              sum=sum+num;

          }

          if(num==999)

          {

              printf("Sum of Positive numbers=%d",sum);

              getch();

              exit(0);

          }

     }

     getch();

}

FREE Hit Counters