HTML 5 – Hands On Assignments

HTML 5 :  Hands on Assignments 

 

Assignment 1:- 1.Create a HTML5 web page which is used for a Stock Trading App Requirements:  

  1. The stock ticker symbol and price as below should be displayed in a table format 
  2. The Stock trading form below should allow the user to enter the TICKER symbol and the quantity of shares that the user wishes to purchase. 
  3. The shares/stocks can be purchased only in block of 10s (ie10 shares, 20 shares, 30 shares…..). Validate that the ‘quantity’ input can only take numbers as its value and min is 10 and max is 100 and can be bought only in blocks of 10s as discussed earlier.

HTML Code: 

<html> 

<h1>Stock Trading</h1> 

<head> 

<style> 

table, td { 

  border: 1px solid black; 

} 

</style> 

<script> 

function validateForm() { 

  var x = document.forms[“myForm”][“lname”].value; 

  if (x!=10 && x!=20 && x!=30 && x!=40 && x!=50 && x!=60 && x!=70 && x!=80 && x!=90 && x!=100) { 

    alert(“The shares/stocks can be purchased only in block of 10s (ie 10 shares, 20 shares, 30 shares…..)and quantity can only take numbers as its value and min is 10and max is 100”); 

    return false; 

  } 

} 

</script> 

</head> 

<body> 

 

<form name=”myForm” onsubmit=”return validateForm()” method=”post”> 

<table> 

<tr> 

<td>Ticker:</td> 

<td><select><option value=”wipro”>WIPRO</option> 

  <option value=”infy”>INFY</option> 

  <option value=”tcs”>TCS</option> 

  <option value=”techm”>TECHM</option> 

</select> 

</tr> 

<tr> 

<td>Quantity:</td> 

<td><input type=”text” id=”lname” name=”lname”></td> 

</tr> 

<tr> 

<td><input type=”submit” value=”submit”></td> 

</tr> 

</table> 

</form> 

</body> 

</html> 

 

Assignment 2: Create a Web Page for an Event Management Company “Xena Events” which is conducting a hot balloon riding event from Feb 28th 2017 onwards for 5 days. The Web Page should have the below:  

  1. Heading with appropriate name and logo. 
  2. A form where people can register for this event with the below details: 
  3. Name :should allow only alphabets. 
  4. Age : should be equal to or greater than 18.  
  5. Email ID : should be a valid email id format d. City: On clicking on the text box, Should display a list that contains city names as “Rajkot”, “Vizag” and “Bangalore” but whatever the user enters also should be shown in the list Note: All entries are “mandatory”.

HTML Code: 

<html> 

<body> 

<script> 

function validateForm() { 

if (!/^[a-zA-Z]*$/g.test(document.myForm.name.value))  

{ 

   alert(“Name should only have alphabets”); 

   document.myForm.name.focus(); 

   return false; 

} 

var y = document.forms[“myForm”][“age”].value; 

if(y>=18) 

{ 

   return true; 

} 

else 

{ 

   alert(” Age should be equal to or greater than 18″); 

   return false; 

} 

} 

function validateEmail(emailField){ 

   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; 

   if (reg.test(emailField.value) == false)  

        { 

            alert(‘Invalid Email Address’); 

            return false; 

        } 

return true; 

 

} 

</script> 

<center> 

<table> 

<tr> 

<td><h1><b>Hot Balloon Riding Event</b></h1></td> 

<td><img src=”ballon.gif” alt=”HTML5 Icon” style=”width:128px;height:128px;”></td> 

</tr> 

</table></center> 

<form name=”myForm” onsubmit=”return validateForm()” method=”post”> 

<center> 

<table> 

<tr><td><h3>Name:</h3></td><td><input type=”text” name=”name” id=”name” required></td></tr> 

<tr><td><h3>Age:</h3></td><td><input type=”text” name=”age” required></td></tr> 

<tr><td><h3>Email ID:</h3></td><td><input type=”text” name=”eid” id=”eid” onblur=”validateEmail(this);” required></td></tr> 

<tr><td><h3>City:</h3></td><td> 

<input type=”text” list=”city” required/> 

<datalist id=”city” value=””> 

<option value=”Hyderabad”>Hyderabad</option> 

<option value=”Rajkot”>Rajkot</option> 

<option value=”Rajkot”>Rajkot</option> 

<option value=”Chennai”>Chennai</option> 

<option value=”Goa”>Goa</option> 

<option value=”UP”>UP</option> 

<option value=”Kerela”>Kerela</option> 

<option value=”Coimbatore”>Coimbatore</option> 

<option value=”Vizag”>Vizag</option> 

<option value=”Bangalore”>Bangalore</option> 

</datalist></td></tr> 

<tr><td colspan=”2″><center><input type=”submit” value=”Submit”></center></td> 

</table></center> 

</form> 

</body> 

</html> 

Assignment-3:- Create a Web Page with two horizontal sections.  

  1. The top horizontal section should have the heading “Awesome Online videos” along with an image acting as a logo. 
  2. The bottom horizontal section should have a view area to play the video of the week. 
  3. Under the view area, there should be only 2 buttons “play” and “pause” which the user can use to play or pause the video of the week.

HTML Code: 

Frame.html 

<html> 

<head> 

<frameset rows = “25%,75%” border=”0″> 

<frame name = “top” src = “top.html” scrolling=no/> 

<frame name = “main” src = “main.html” scrolling=no/> 

</frameset> 

<head> 

</html> 

 

Top.html 

<html> 

<body> 

<center> 

<table> 

<tr> 

<td><h1><b>Awesome Online videos</b></h1></td> 

<td><img src=”stoerer_en.gif” alt=”HTML5 Icon” style=”width:128px;height:128px;”></td> 

</tr> 

</table></center> 

</body> 

</html> 

Main.html 

<html> 

<body> 

<center> 

<table> 

<tr> 

<td><h1><b>Awesome Online videos</b></h1></td> 

<td><img src=”stoerer_en.gif” alt=”HTML5 Icon” style=”width:128px;height:128px;”></td> 

</tr> 

</table></center> 

</body> 

</html> 

 

Assignment 4: For the BCCI (Board of Control for Cricket in India) web page, we need to show a line chart for the batting statistics of the Indian team for a T20 cricket match. The details are as follows: Over 5, 10, 15 and Runs 40, 75, 140 

HTML Code: 

<html> 

<head>   

<script> 

window.onload = function () { 

var chart = new CanvasJS.Chart(“chartContainer”, { 

animationEnabled: true, 

theme: “light2”, 

axisX:{ 

minimum: 4, 

maximum: 20 

}, 

axisX:{ 

title : “Over” 

}, 

axisY:{ 

 title : “Runs” 

 }, 

 data: [{         

 type: “line”, 

 indexLabelFontSize: 16, 

dataPoints: [ 

{ y: 40 , x: 5}, 

{ y: 75 , x: 10}, 

{ y: 140 , x: 15} 

] 

}] 

}); 

chart.render(); 

} 

</script>