Introduction To Web Technology Notes
Introduction To Web Technology Notes
Got it! I'm ready to create detailed study notes with example code as per your format
whenever you upload the PDFs. Just send them my way!
L01-HTML.pdf
PDF
Here's a detailed set of study notes based on your PDF about HTML:
html
<html>
<head>
<title>JT</title>
</head>
<body>
Hello World!
</body>
</html>
The basic structure of an HTML document starts with <html> and ends with
</html> .
The <head> section contains metadata, while the <body> section contains the
visible content.
3. HTML Tags
27/74
Example structure:
html
<html>
<body>
<p>This is a paragraph</p>
</body>
</html>
4. Common Tags
html
<h1>Heading 1</h1>
<h6>Heading 6</h6>
Paragraphs: <p>
html
<p>This is a paragraph.</p>
html
html
<hr />
5. Character Entities
28/74
" becomes "
6. Text Formatting
Example:
html
html
<pre>
Mary
had a
little lamb
</pre>
html
<pre>
<code>
sum = a + b + c;
</code>
</pre>
9. Images
html
29/74
Attributes:
10. Links
html
11. Lists
Unordered List:
html
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
Ordered List:
html
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Definition List:
html
<dl>
<dt>Term</dt>
<dd>Definition</dd>
</dl>
30/74
12. Tables
html
13. Comments
html
These notes cover fundamental HTML elements, attributes, and usage with example code for
practical understanding. Let me know if you'd like any additional details or further
breakdowns!
L02-CSS.pdf
PDF
31/74
Chapter: Introduction to CSS
1. What is CSS?
html
Document (Internal) CSS: Using the <style> tag within the <head> section of an
HTML document.
html
<html>
<head>
<style>
body { background-color: lightgrey; }
h1 { color: blue; }
</style>
</head>
<body>
<h1>This is a heading</h1>
</body>
</html>
External CSS: Linking an external .css file using the <link> tag.
html
Example in mystyle.css :
css
32/74
h1 { color: blue; }
html
4. Color in CSS
Inline CSS has the highest precedence, followed by document CSS, then external
CSS.
6. Selectors
css
p {
border: 1px solid black;
padding: 10px;
}
css
.userInfo {
border: 1px solid black;
33/74
padding: 10px;
}
html
css
#userHeading {
color: blue;
}
html
Descendant Selector:
css
div i {
color: red;
}
Child Selector:
css
div > i {
color: red;
}
8. Contextual Selectors
34/74
div.userInfo i {
color: red;
}
9. Pseudo-Class Selectors
a:link {
color: red;
}
a:visited {
color: green;
}
h1:hover {
color: blue;
}
Ordered List:
html
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
css
ol {
list-style-type: decimal;
}
ol ol {
list-style-type: upper-roman;
}
35/74
ol {
list-style-image: url('path/to/image.png');
}
css
span.specialText {
color: red;
font-size: 150%;
}
html
css
div.userInfo {
border: 1px solid black;
padding: 10px;
}
html
<div class="userInfo">
<p>User Information</p>
</div>
css
36/74
/* This is a multi-line comment */
}
L03-Form.pdf
PDF
Here's a detailed set of study notes for your web form PDF:
HTML forms are used to collect user input and send it to a server for processing.
Text fields
Textareas
Checkboxes
Radio buttons
Selection dropdowns
Submit buttons
html
37/74
<input type="submit" value="Login">
<input type="reset" value="Reset form">
</form>
3. Form Elements
html
Password Field:
html
Checkboxes:
html
Radio Buttons:
html
Selection Dropdown:
html
<select name="day">
<option value="mon">Monday</option>
<option value="tue">Tuesday</option>
</select>
Multi-Select Dropdown:
38/74
html
Textarea:
html
GET Method:
html
POST Method:
Data is sent in the body of the request and is not visible in the URL.
html
Data Length: GET has URL length limitations; POST does not.
Data Type: GET supports only ASCII characters; POST allows binary data.
39/74
5. Reset Button
html
The name attribute in form elements is essential as it identifies the input data when
sent to the server.
Google Search Form Example: Access the Google search form to understand how
parameters are passed:
html
http://www.uow.edu.au/~dong/w3/example/form/google-search.html
These notes summarize essential concepts and code examples for using HTML forms. Let me
know if you'd like additional details or further examples!
L04-Javascript1.pdf
PDF
40/74
Chapter: The Basics of JavaScript
1. Introduction to JavaScript
html
In the Head:
html
<head>
<script>
function sayHi() {
alert("Hi");
}
</script>
</head>
html
<body>
<!-- Page content -->
<script>
function sayHi() {
alert("Hi");
}
</script>
</body>
4. External JavaScript
41/74
<script src="js/myscript.js"></script>
html
html
Variables:
javascript
Comments:
42/74
javascript
// Single-line comment
/* Multi-line comment */
Number:
javascript
String:
javascript
Boolean:
javascript
9. Operators
Arithmetic Operators: + , - , * , / , % , ++ , --
Comparison Operators:
javascript
if (x == y) { /* equal value */ }
if (x === y) { /* equal value and type */ }
if (x != y) { /* not equal value */ }
if (x !== y) { /* not equal value or type */ }
javascript
43/74
var now = new Date();
alert(now); // Displays current date and time
Date Methods:
javascript
javascript
12. Arrays
javascript
13. Objects
javascript
var student = {
name: "John",
age: 21
};
44/74
alert(student.name); // "John"
student.age = 22; // Change age
javascript
15. Dialogs
Confirm Box:
javascript
Prompt Box:
javascript
These notes provide an overview of fundamental JavaScript concepts with practical examples.
Let me know if you need more details or further breakdowns!
L05-Javascript2.pdf
PDF
Here's a detailed set of study notes for your JavaScript Form Validation PDF:
45/74
Chapter: JavaScript Form Validation
1. Form Validation Basics
HTML forms often use JavaScript to validate user input before submission.
html
html
<script>
function validateForm() {
var email = document.getElementById("email").value;
if (email == null || email.trim() == "") {
alert("Email must be filled out");
return false;
}
return true;
}
</script>
Use a <span> element to display error messages near the input fields.
html
46/74
<input type="submit" value="Submit">
</form>
<script>
function validateForm() {
var email = document.getElementById("email").value;
if (email == null || email.trim() == "") {
document.getElementById("emailError").innerHTML = "Email must be
filled out";
return false;
}
document.getElementById("emailError").innerHTML = ""; // Clears the
message if valid
return true;
}
</script>
html
<style>
.errorMessage {
color: red;
}
</style>
Example of matching two input fields (e.g., email and email confirmation):
html
<script>
47/74
function validateForm() {
var email = document.getElementById("email").value;
var email2 = document.getElementById("email2").value;
if (email == null || email.trim() == "") {
document.getElementById("emailError").innerHTML = "Email must be
filled out";
return false;
}
document.getElementById("emailError").innerHTML = ""; // Clears the
message if valid
if (email.trim() != email2.trim()) {
document.getElementById("emailError2").innerHTML = "Emails do not
match";
return false;
}
return true;
}
</script>
6. Handling Whitespace
javascript
html
<script>
function validateForm() {
var answer = prompt("What is 1 + 2?");
48/74
if (answer == null || answer != 3) {
return false; // Prevent form submission if the answer is incorrect
}
return true;
}
</script>
javascript
html
49/74
^\d{2,}$ : At least 2 digits
These notes cover JavaScript form validation essentials and include practical examples for
input handling and validation techniques. Let me know if you need more examples or further
clarification!
L06-Javascript3.pdf
PDF
Here's a detailed set of study notes for your additional JavaScript PDF:
javascript
javascript
var s = "100";
var x = Number(s);
html
<span id="mark"><b>87</b></span>
javascript
50/74
// Get text content
var mark = document.getElementById("mark").textContent; // Returns "87"
javascript
html
html
51/74
function goToUOW() {
window.location.assign("http://www.uow.edu.au");
}
</script>
html
html
html
<script>
function addSubject() {
var subject = prompt("Enter subject code");
52/74
if (subject != null) {
var para = document.createElement("p");
var node = document.createTextNode(subject);
para.appendChild(node);
document.getElementById("subjectList").appendChild(para);
}
}
</script>
Repeated Alerts:
javascript
function alertForever() {
var alertSchedule = setInterval(alertFunction, 5000);
}
function alertFunction() {
alert("Hello!");
}
Stopping an Interval:
javascript
var alertSchedule;
function stopIt() {
clearInterval(alertSchedule);
}
Clock Display:
html
53/74
}
</script>
html
javascript
function slideShow() {
setInterval(changeImage, 2000);
}
function changeImage() {
var imageList = [
"images/simpson2.png",
"images/simpson4.png",
"images/simpson6.png",
"images/simpson1.jpg",
"images/simpson3.jpg",
"images/simpson5.png",
"images/simpson7.jpg"
];
54/74
var index = Math.floor(Math.random() * imageList.length);
document.getElementById("simpson").src = imageList[index];
}
html
These notes cover essential JavaScript concepts, event handling, dynamic content creation,
and basic animations. Let me know if you'd like additional examples or further explanations!
L07-XML-DTD-XSD.pdf
PDF
Here's a comprehensive set of study notes for your XML, DTD, and XSD PDF:
XML is a markup language similar to HTML but is designed for data storage and
transport.
55/74
<mobile>0211223344</mobile>
</student>
2. XML Declaration
The XML declaration is optional but should be at the first line of the document.
xml
3. XML Structure
<rootElement>
<child>
<subchild>Content</subchild>
</child>
</rootElement>
<student gender="M">
<firstName>John</firstName>
<lastName>Smith</lastName>
</student>
<emptyElement />
56/74
<student>
<firstName>John</firstName>
<lastName>Smith</lastName>
</student>
6. Entity References
< → <
> → >
& → &
' → '
" → "
7. Comments in XML
xml
xml
57/74
xml
Content of student.dtd :
xml
xml
58/74
1. Complex and Simple Types
xml
<xsd:element name="person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="firstName" type="xsd:string"/>
<xsd:element name="lastName" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="gender" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
xml
2. Restrictions in XSD
<xsd:element name="grade">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="A"/>
<xsd:enumeration value="B"/>
<xsd:enumeration value="C"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
These notes summarize key concepts of XML, DTD, and XSD with practical examples for each.
Let me know if you need further clarification or additional details!
59/74
L08-XSLT.pdf
PDF
It includes:
2. XSLT Overview
XSLT transforms XML documents into different formats, enabling their display or
further processing.
The document defines how XML elements should be processed and displayed.
xml
60/74
Chapter: Example XML and XSLT Usage
1. Example XML Document
xml
xml
xml
61/74
<head>
<title>XSLT Example</title>
</head>
<body>
<h1>Daily transaction <xsl:value-of select="@date" /></h1>
<ul>
<xsl:for-each select="person">
<li>
<xsl:value-of select="firstName" />
<xsl:text> </xsl:text>
<xsl:value-of select="lastName" />
<xsl:text>, </xsl:text>
<xsl:value-of select="mobile" />
<xsl:text>, </xsl:text>
<xsl:value-of select="@staffDbId" />
<xsl:text>, </xsl:text>
<xsl:value-of select="@operation" />
</li>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<table border="1">
<tr>
<th>Name</th>
<th>Mobile</th>
<th>Staff ID</th>
<th>Operation</th>
</tr>
<xsl:apply-templates select="person">
<xsl:sort select="lastName" />
62/74
</xsl:apply-templates>
</table>
xml
<xsl:choose>
<xsl:when test="@operation = 'add'">
<td bgcolor="#ffffe6">
<xsl:value-of select="@operation" />
</td>
</xsl:when>
<xsl:otherwise>
<td bgcolor="#d6f5d6">
<xsl:value-of select="@operation" />
</td>
</xsl:otherwise>
</xsl:choose>
xml
<td align="center">
<img>
<xsl:attribute name="src">
<xsl:text>images/</xsl:text>
<xsl:value-of select="@operation"/>
<xsl:text>.png</xsl:text>
</xsl:attribute>
<xsl:attribute name="width">30px</xsl:attribute>
</img>
</td>
These notes summarize the core concepts of XSLT, including transforming XML documents,
using templates, and applying conditional logic. Let me know if you'd like more detailed
explanations or further examples!
63/74
L09-JSON.pdf
PDF
JSON is a lightweight data-interchange format that is easy for humans to read and
write, and easy for machines to parse and generate.
Example:
json
{
"firstName": "John",
"lastName": "Smith",
"domestic": true,
"fee": 100.5
}
javascript
64/74
javascript
4. JSON Arrays
Example:
json
[
{
"firstName": "John",
"lastName": "Smith"
},
{
"firstName": "Kate",
"lastName": "Williams"
}
]
javascript
function showJSON() {
var john = {};
john.firstName = "John";
john.lastName = "Smith";
john.domestic = true;
john.fee = 100.50;
html
65/74
2. Example: Converting JSON String to JavaScript Object
javascript
function showObject() {
var johnJSON =
'{"firstName":"John","lastName":"Smith","domestic":true,"fee":100.5}';
var john = JSON.parse(johnJSON);
console.log(john);
console.log("Full name is " + john.firstName + " " + john.lastName);
}
html
javascript
function showJSON() {
var john = { firstName: "John", lastName: "Smith" };
var kate = { firstName: "Kate", lastName: "Williams" };
html
javascript
function showArray() {
var studentListJSON = '[{"firstName":"John","lastName":"Smith"},
{"firstName":"Kate","lastName":"Williams"}]';
var studentList = JSON.parse(studentListJSON);
console.log(studentList);
66/74
console.log("There are " + studentList.length + " students");
}
html
javascript
function showJSON() {
var john = {
firstName: "John",
lastName: "Smith",
enrolledSubjects: [
{ code: "MATH101", title: "Algebra" },
{ code: "CSIT122", title: "C programming" }
]
};
json
{
"firstName": "John",
"lastName": "Smith",
"enrolledSubjects": [
{ "code": "MATH101", "title": "Algebra" },
{ "code": "CSIT122", "title": "C programming" }
]
}
67/74
function getMarketAjax() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
processResult(xhttp);
}
};
xhttp.open("GET", "market.json", true);
xhttp.send();
}
javascript
function processResult(xhttp) {
var jsonText = xhttp.responseText;
var marketObj = JSON.parse(jsonText);
display(marketObj);
}
javascript
function display(marketObj) {
var html = "<h1>Stock Market Activity " + marketObj.queryTime + "</h1>";
html += "<table border='1'>";
html += "<tr><th>Index</th><th>Value</th><th>Change</th><th>Net / %</th>
</tr>";
68/74
html += "<td align='right'>" + marketObj.indexList[i].netPercentage + "%
</td>";
html += "</tr>";
}
html += "</table>";
document.getElementById("marketDiv").innerHTML = html;
}
html
These notes summarize the key concepts of JSON, including creating and parsing JSON data,
as well as using JSON with AJAX. Let me know if you need further examples or additional
explanations!
L10-HTML5(graphic).pdf
PDF
Here's a comprehensive set of study notes based on your HTML5 Graphics and Drag-and-
Drop PDF:
1. Canvas Overview
Canvas was introduced by Apple in WebKit for OS X Dashboard and is now implemented
in all major browsers.
html
69/74
<canvas id="mycanvas" width="1000" height="500" style="border:1px solid black;">
Your browser does not support canvas.
</canvas>
The <canvas> element only acts as a container. JavaScript is needed to draw on it.
javascript
javascript
javascript
context.beginPath();
context.moveTo(50, 10);
context.lineTo(50, 400);
context.lineTo(250, 400);
context.strokeStyle = "blue";
context.lineWidth = 4;
context.stroke();
javascript
70/74
context.beginPath();
context.moveTo(50, 10);
context.lineTo(50, 400);
context.lineTo(250, 400);
context.closePath();
context.fillStyle = "#F5FFFA"; // Fill color
context.fill(); // Fills the enclosed path with color
1. Drag-and-Drop Overview
Allows users to drag elements and drop them onto other elements.
Requires defining:
Draggable elements
Droppable elements
html
html
javascript
function dragOver(event) {
event.preventDefault();
}
71/74
javascript
function dragStart(event) {
var dragId = event.target.id;
event.dataTransfer.setData("dragId", dragId);
}
javascript
function drop(event) {
event.preventDefault();
var dragId = event.dataTransfer.getData("dragId");
var dropId = event.target.id;
Draggable Elements:
html
Droppable Elements:
html
72/74
javascript
var catCount = 0;
function drop(event) {
event.preventDefault();
var dragId = event.dataTransfer.getData("dragId");
var dropId = event.target.id;
javascript
function drop(event) {
event.preventDefault();
var dragId = event.dataTransfer.getData("dragId");
var dropId = event.target.id;
document.getElementById("catDiv").appendChild(img);
}
}
References
HTML5 Canvas API
73/74
These notes cover the fundamentals and some advanced concepts of HTML5 Canvas and
Drag-and-Drop functionalities. Let me know if you need further examples or clarifications!
74/74