Unit 1 of 1 · BCA Sem 2

Unit 1: Building a website end to end

Web Technologies Laboratory notes · PTU syllabus (UGSEC2506)

3 min read4 topics7 exam questions
On this page
  1. Unit summary
  2. Page-building exercises
  3. Media and layout
  4. Styling with CSS: the hospital front page
  5. JavaScript validation
  6. Key terms
  7. Quick revision
  8. Important questions

Unit summary

In this lab you build web pages step by step, ending with a complete institute website with JavaScript validation. The exercises cover text formatting, lists, tables, links, media, frames, CSS and form validation.

After this unit you can

  • Build pages using formatting, lists, tables and links
  • Embed audio and video and create multi-frame layouts
  • Style pages using internal and external style sheets
  • Validate login and registration forms with JavaScript

PTU syllabus topics

  • Simple HTML tag demonstration
  • book index page
  • college letterhead page
  • in-page hyperlink navigation
  • text formatting for a letter
  • department timetable
  • table-based page layout
  • embedding audio/video
  • multi-frame page layout
  • student bio-data page
  • hospital front page with style sheets
  • multi-page display
  • JavaScript-validated login form
  • JavaScript-validated registration form
  • a complete institute/department/tutorial website with JavaScript validation
ProcessBuilding the final website
  1. 1Plan pages

    Home, departments, tutorials, contact

  2. 2Structure with HTML

    Headings, lists, tables, links

  3. 3Style with CSS

    Consistent fonts, colours and layout

  4. 4Add JavaScript

    Validate login and registration forms

  5. 5Test

    Different browsers and screen sizes

1

Topic 1

Page-building exercises

ExerciseKey tags
Book index page<ol>, nested lists, <a> links to chapters
College letterhead<h1>, <img>, <hr>, <address>, CSS for layout
In-page navigationid attributes and <a href="#section">
Formatted letter<p>, <b>, <i>, <u>, <br>, alignment
Department timetable<table>, <th>, colspan, rowspan, <caption>
Student bio-dataTable or definition list with photo
2

Topic 2

Media and layout

  • Audio: <audio src="song.mp3" controls></audio>
  • Video: <video src="tour.mp4" width="480" controls></video>
  • Multi-frame page: a logo frame at the top, a menu on the left and content on the right — built with <frameset> in old HTML, or with <iframe> and CSS layout today.
3

Topic 3

Styling with CSS: the hospital front page

html<link rel="stylesheet" href="hospital.css">
cssbody { font-family: Arial, sans-serif; margin: 0; }
header { background: #0b6b3a; color: white; padding: 20px; }
nav a { color: white; margin-right: 15px; text-decoration: none; }
.card { border: 1px solid #ddd; border-radius: 8px; padding: 15px; }
4

Topic 4

JavaScript validation

ProcessValidating a registration form
  1. 1

    Read values

    document.forms["reg"]

  2. 2

    Check required fields

    Not empty

  3. 3

    Check formats

    Email contains @ and a dot; phone has 10 digits

  4. 4

    Check passwords

    Length ≥ 8 and both entries match

  5. 5

    Show errors

    alert or a message next to the field

  6. 6

    Return true or false

javascriptfunction validateReg() {
  const f = document.forms["reg"];
  if (!/^[0-9]{10}$/.test(f.phone.value)) { alert("Enter a 10-digit phone"); return false; }
  if (f.pwd.value !== f.cpwd.value) { alert("Passwords do not match"); return false; }
  return true;
}

Exam tip

The final project — an institute website with department pages, tutorial links and validated forms — usually carries the most marks. Keep a consistent navigation bar and one external CSS file for all pages.

Key terms

controls attribute
Shows play/pause buttons on audio and video
External style sheet
A .css file shared by many pages
Regular expression
A pattern used to check input formats
Form validation
Checking input before it is submitted

Quick revision

  • Use id and #id for in-page links.
  • audio/video need the controls attribute.
  • One external CSS file keeps the whole site consistent.
  • Return false from onsubmit to block invalid forms.

Important exam questions

Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).

Short-answer questions

  1. Q1.How do you embed a video in an HTML page?
  2. Q2.How do you link an external style sheet?
  3. Q3.What does the regular expression ^[0-9]{10}$ check?
  4. Q4.Why is client-side validation useful?

Long-answer questions

  1. Q1.Create a department timetable using tables with colspan and rowspan.
  2. Q2.Design a hospital front page using an external style sheet.
  3. Q3.Write a registration form with JavaScript validation for name, email, phone and password.

Stuck on this unit?

Message SBS on WhatsApp for help with Web Technologies Laboratory, or to ask about studying BCA at Synetic.

WhatsApp us