Tuesday, November 26, 2013

SOFT6007 Class 41

Students did an in class exercise in groups in preparation for next week's exam



SOFT6007 Web Development Fundamentals
Assessment 3

This is a one-sheet exam. Students are permitted to bring one sheet of A4 notes (front and back) into the exam. Students must hand up this question sheet and the sheet of notes with their answer books.


craps.html is a web page with JavaScript code that simulates the throw of two dice. If the sum of the dice is 7 then the text shows “You Win!” and it shows “You Lose” otherwise. When the button “Pull” is clicked a function pull is called to change the appearance of the page using the Document Object Model (DOM).





The HTML for the page is shown below, but the code for the pull function is not shown. Write in your answer book the code for the pull function.
The dice images are named die1.png, die2.png, die3.png, die4.png, die5.png, die6.png.


<html>
<head><title>Game of Craps</title>
<script type="text/javascript">
function pull()
{
}
</script>
</head>

<body>

<div id="fisrt"><img src="dice1.png" name="die1" id="d1" width="100" height="100" alt="slot" /></div>
<div id="second"><img src="dice1.png" name="die2" id="d2" width="100" height="100" alt="slot" /></div>

<br/><br/><br/><br/>
<button type="button" onclick="pull()">Pull</button>
<div id="sometext">Blah blah blah</div>

</body>
</html> 



No comments: