University of Mauritius: Web Technology I (Cse1041) Test
University of Mauritius: Web Technology I (Cse1041) Test
My Hobbies 25%
75%
1|Page
(a) Write the html codes for the following pages:
(i) Home.html [5 marks]
(ii) Summer.html [4 marks]
(b) Assuming that Pictures.html will contain the images pic1.gif and pic2.gif, write html
codes for showing the images on Pictures.html.
Note:
• Each picture should appear on a different line
• You are NOT requested to write the whole web page.
• All images are saved in the folder images found in the same directory as the html
pages.
[2 marks]
(c) Assuming we have the external CSS file myCSS.css, write the proper codes which
should be inserted in Summer.html to link it to myCSS.css.
Note:
• myCSS.css is store in the folder cssFiles found in the same directory as the html
page.
• You are NOT requested to write the whole web page.
[2 marks]
(d) Assuming Summer.html is linked to the css file myCSS.css (See part (c) above), use
CSS Inline to override the option “Music” with:
• Colour - Red
• Text - Uppercase.
[2 marks]
2|Page
Question 2 [15 marks]
(a) Consider the following screenshot and the codes for login.html below:
Screenshot:
Login.html:
<head>
<body>
<form id=frm_feedback action="test.html" method="post">
<table border="1" align="middle">
<tr>
<td>Username</td>
<td><input type=text name="txt_Username"
onblur="validateBlank(this.value,'Username');"></td>
</tr>
<tr>
<td>Password</td>
<td><input type=password name="txt_pwd"
onblur="validatePassword(this.value,'Password');"></td>
</tr>
<table>
</form>
</body>
</html>
(i) Write the codes for the function validateBlank (called in Login.html above),
which checks if the Username is Blank and outputs the following popup if the
username is blank:
[3 marks]
3|Page
(ii) Write the codes for function validatePassword which will do the following:
• Check if the password is blank by calling the function validateBlank in
part (i) above
• If the password is not blank, it only accepts passwords starting with a
letter (lowercase or uppercase) and followed by digits. If this is not
successful it will output the following error message:
(b) Consider the screenshot for the form below and the corresponding codes for Form1.
html:
Screenshot
Form1.html
<html>
<head>
</head>
<body>
<form id=frm_feedback action="test.html" method="post">
<table border="1" align="middle">
<tr>
<td>value 1</td>
<td><input type=text name="txt_val1"
onblur="chkBlank(txt_val1.value);"></td>
</tr>
<tr>
<td>value 2</td>
<td><input type=text name="txt_val2"
onblur="chkBlank(txt_val2.value);"></td>
4|Page
</tr>
<tr>
<td colspan="2" align="center"><input type=button
name="Check" value="check">
<input type=reset name=reset>
</td>
</tr>
</table>
</form>
</body>
</html>
(i) Insert the appropriate codes in Form1.html to link it to the file Exercise.js (stored
under the same folder as Form1.html). Exercises.js contains all the javascript
functions used in Form1.html .
Note: You need not write the whole html file again.
[2 marks]
(ii) When the button check is clicked, the function chkmax is called. chkmax takes
two parameters as input; the values entered for value 1 and value 2. Insert the
appropriate codes in Form1.html to call the function chkmax.
Note: You need not write the whole html file again.
[2 marks]
function chkMin(val1,val2)
{
if (val1<val2)
{
return val1;
}
else
{
return val2;
}
}
The function disp takes as input the values entered for value 1 and value 2
and calls the function chkmin to display the message:
Value … is smaller
5|Page