Posts

Showing posts from March, 2022

Javascript Code Using If Else to Compute Discount based on Grades

<html>    <body>           <script type = "text/javascript">          <!-- var grade= prompt("Enter grade");  var tuition=prompt("Enter tuition fee");            if (grade>=99)              {                discount=tuition *1;                document.write("<b> COngrats You Deserved 100% Discount " );              }            else if(grade >=95)                  {                 discount=tuition *.50;                document.write("<b> COngrats You Deserved 50% Discount " );               }    ...

Javascript Code using getElementById and If Else Statement

  <!DOCTYPE html> <html> <head> <title> Form Elements and Attributes </title> <style> //format and styles div { margin-bottom: 10px; } label { display: inline-block; width: 200px; } fieldset { background: #e1eff2; } legend { padding: 20px 0; font-size: 20px; } </style> <body> <body> <h1> Determine Age Group </h1> <p> Enter your details : </p> <fieldset> <label> Enter your name </label> <input type =" text " onfocus =" this.value='' " name =" fname " id =" fname " value ="" /> <br> <!-- create input text box for name --> <label> Enter your age </label> <input type =" number " onfocus =" this.value='' " name =" age " i...

Javascript Code Output document.write in the body

First Javascript Program place on the body

Javascript Sample Code : Using document.write in the body

 <html> <head> <title>First Javascript Program place on the body </title> </head>     <body>          <script language = "javascript" type = "text/javascript">          <!-- use comment for browsers that does not support javascipt            var name;                document.write("<br> welcome to Javascript Programming " );   name=prompt("Enter your name")        age=prompt("Enter your age");                document.write("<br> Name :  <b>" +name );                document.write("<br> Age :  <b>" + age );       course=prompt("Enter your Course");                document.write("<br> Course :  ...