update,
This commit is contained in:
51
it114105/itp4513/Lab07/Lab7_Task1.html
Normal file
51
it114105/itp4513/Lab07/Lab7_Task1.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Untitled Document</title>
|
||||
</head>
|
||||
<style>
|
||||
#titleBlock{
|
||||
width: 800px;
|
||||
height: 50px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
function changeBG(){
|
||||
obj = document.getElementById("titleBlock");
|
||||
if(obj.style.backgroundColor=="green"){
|
||||
obj.style.backgroundColor = "Coral";
|
||||
}else{
|
||||
obj.style.backgroundColor = "green";
|
||||
}
|
||||
}
|
||||
function Msg(elmnt){
|
||||
name = document.getElementById("name").value;
|
||||
selected = elmnt.value;
|
||||
alert("Hello, "+name+"\nMeet you at this " +selected+"!");
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div id="titleBlock" style="background-color: Green">
|
||||
<h2>Welcome to Internet ' Multimedia Applications</h2>
|
||||
</div>
|
||||
<button onClick="changeBG();">Swap Background between Green and Goral</button><br>
|
||||
<p>Name:<input type="text" id="name" value="Peter Pan"></p>
|
||||
<p>Choose your free time-slots?</p>
|
||||
<table border="1" cellspacing="0" width="100%" >
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<input type="radio" name="weekdays" value="Monday" onClick="Msg(this);"> Monday
|
||||
<input type="radio" name="weekdays" value="Tuesday" onClick="Msg(this);"> Tuesday
|
||||
<input type="radio" name="weekdays" value="Wednesday" onClick="Msg(this);"> Wednesday
|
||||
<input type="radio" name="weekdays" value="Thursday" onClick="Msg(this);"> Thursday
|
||||
<input type="radio" name="weekdays" value="Friday" onClick="Msg(this);"> Friday
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
28
it114105/itp4513/Lab07/Lab7_Task2.html
Normal file
28
it114105/itp4513/Lab07/Lab7_Task2.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Untitled Document</title>
|
||||
<link rel="stylesheet" type="text/css" href="styles/layout.css">
|
||||
</head>
|
||||
<script>
|
||||
function showPic(whichpic){
|
||||
document.getElementById("placeholder").setAttribute("src", whichpic.href);
|
||||
document.getElementById("description").innerHTML = whichpic.title;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<h1>Photo Gallery</h1>
|
||||
<ul>
|
||||
<li><a href="images/fireworks.jpg" title="A fireworks display" onClick="showPic(this); return false">Fireworks</a></li>
|
||||
<li><a href="images/coffee.jpg" title="A cup of black coffee" onClick="showPic(this); return false">Coffee</a></li>
|
||||
<li><a href="images/rose.jpg" title="A red rose" onClick="showPic(this); return false">Rose</a></li>
|
||||
<li><a href="images/bigben.jpg" title="The famous clock" onClick="showPic(this); return false">Big Ben</a></li>
|
||||
|
||||
</ul>
|
||||
<img id="placeholder" src="images/placeholder.gif" alt="my image gallery">
|
||||
<p id="description">Choose an image from the above...</p>
|
||||
</body>
|
||||
</html>
|
34
it114105/itp4513/Lab07/Lab7_Task3.html
Normal file
34
it114105/itp4513/Lab07/Lab7_Task3.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Untitled Document</title>
|
||||
</head>
|
||||
<script>
|
||||
function jsonParse(){
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange= function(){
|
||||
if(xmlhttp.readyState==4 && xmlhttp.status==200){
|
||||
showTable(xmlhttp.responseXML);
|
||||
}
|
||||
}
|
||||
xmlhttp.open("GET","books.xml",true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
function showTable(xml){
|
||||
var table = "<tr><th>Title</th><th>Author</th><th>Year</th><th>Price</th></tr>";
|
||||
var books = xml.getElementsByTagName("book");
|
||||
for(var i=0; i< books.length;i++){
|
||||
table +="<tr><td>" + books[i].getElementsByTagName("title")[0].childNodes[0].nodeValue+"</td><td>"+books[i].getElementsByTagName("author")[0].childNodes[0].nodeValue+"</td><td>"+books[i].getElementsByTagName("year")[0].childNodes[0].nodeValue+"</td><td>"+books[i].getElementsByTagName("price")[0].childNodes[0].nodeValue+"</td></tr>";
|
||||
}
|
||||
document.getElementById("btable").innerHTML = table;
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<h1>Read from books.xml</h1>
|
||||
<button onClick="jsonParse()">List ALL books</button>
|
||||
<table id="btable" border="1">
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user