Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

ICT Department

Year 8

Html CODE
My school web
<head>
<title>My School </title>
</head>
<body bgcolor="magenta"dir="rtl">
<center>
<font face="tahoma"color="red" size="6">MY School</font>
<br>
<font face="andalus"color="purble"size="5">
<a herf="home.html">Main Page</a>&nbsp;&nbsp;
<a herf="home.html">our school</a>&nbsp;&nbsp;
<a herf="home.html">photos</a>&nbsp;&nbsp;
<a herf="home.html">vision&mission</a>&nbsp;&nbsp;
<a herf="home.html">contact us</a>
<br><br>
<img src="school.png"height="100"width="80">
</center>
</body>
</html>

Emotion
<p style="font-size:100px">&#128187;</p>
<p>I will display &#128187;</p>
<p>I will display &#x1F4BB;</p>
Frames
<html>
<body>
<h2>HTML Iframes</h2>
<p>You can use the height and width attributes to specify the size of the iframe:</p>
<iframe src="demo_iframe.htm" height="200" width="300" title="Iframe Example"></iframe>
</body>
</html>
Html form
<html>
<body>
<h2>The select Element</h2>

1
ICT Department
Year 8

<p>The select element defines a drop-down list:</p>


<form action="/action_page.php">
<label for="cars">Choose a car:</label>
<select id="cars" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<input type="submit">
</form>
</body>
</html>
Html + Java
<html>
<body>
<h1>My First JavaScript</h1>
<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="demo"></p>
</body>
</html>
Registration form
<html>
<head>
<title></title>
</head>
<body dir="ltr">
<center>
registration form<br><br><br>
<form action="pro.php">
name<input type="text"><br><br><br>
password<input type="password"><br><br><br>
confirm password<input type="password"><br><br><br

2
ICT Department
Year 8
age (numeric)<input type="text"><br><br><br>
gender<input type="radio">male<input type="radio">female
<br><br><br>
proficiency language
<input type="checkbox">english
<input type="checkbox">French
<input type="checkbox">germany
<br><br><br>
<input type="submit" value="save">
&nbsp&nbsp&nbsp
<input type="reset" value="new">
</center>
</form>
</body>
</html>
Html.Tables
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<h2>HTML Table</h2>
<table>
<tr>
3
ICT Department
Year 8

<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
</body>
</html>
4
ICT Department
Year 8

Java Script Code


Alert statment
<body>
<script> alert("welcome");
</script>
</body>
Java function call
<body>
<input type="button"onclick="country()" value="click me">
<script>
function country()
{
alert ("Arab republic of Egypt");
}
</script>
</body>
If Statement <body>
<form name="form1">
<input type="text" name="t1">
<input type="button" value="total"onclick="total()">
</form>
<script>
function total()
{
if (form1.t1.value>=50)
{
alert("success");
}
}
</script>
</body>
5
ICT Department
Year 8

Data validation required field


<form name="form1" action="data.php">
Student name
<input type="text" name="text1" ><br><br>
<input type="submit" value="send" onclick="return f1();"/>
</form>
<script>
function f1(){
if (form1.text1.value==""){
alert("required field");
return false;
}
}
</script>
Data validation entering type:-
<body dir="rtl">
<form name="form1" action="data.php">
<input type="text" id="text1">
<input type="submit" value="send" onclick="return f1();"/>
</form>
<script>
function f1(){
if (isNaN(form1.text1.value)){
alert("enter a numeric value");
return false;
}
}
</script>
</body>

6
ICT Department
Year 8

Data validation (minimum allowed length:-


<html>
<head>
</head>
<body dir="rtl">
<form name="form1" action="data.php">
<input type="password" id="text1">
<input type="submit" value="send" onclick="return f1();"/>
</form>
<script>
function f1(){
if (form1.text1.value.length<8){
alert("minimum allowed length 8 characters");
return false;
}
}
</script>
</body>
</html>

You might also like