Posts: 5,456
Threads: 5,349
Joined: Dec 2011
Objective:
The goal of this assignment is to get you acquainted with concept of using HTML, java script
and objects in java script.
Lectures Covered: 10-16
BEST OF LUCK
Question: Marks: 15
Part a)
Develop a web page with java script code that should display a button named "Click Here". After
clicking that button an alert should be displayed with text "Java Script is Working". 5 marks
Part b)
Write Java Script code to display digital clock. Time should be updated after every second and output
of the code should be displayed as given in the following figure. (10 marks)
Posts: 9,583
Threads: 8,089
Joined: Apr 2011
span class="start-tag">style type="text/css"> body { background-color: #80d4ea; } #clock{ height: 100px; width: 800px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; padding-top: 70px; font-family: courier, monospace; text-align: center; color: white; font-size: 50px; } p{ text-align: center; margin-bottom: 0px; } </style> </head> span class="start-tag">body> span class="start-tag">div id='clock'> </div> span class="start-tag">script type="text/javascript" langauge="javascript"> function displayTime() { var currentTime = new Date(); var hours = currentTime.getHours(); var minutes = currentTime.getMinutes(); var seconds = currentTime.getSeconds(); // This gets a "handle" to the clock div in our HTML var clockDiv = document.getElementById('clock'); if (seconds < 10) { // Add the "0" digit to the front // so 9 becomes "09" seconds = "0" + seconds; } clockDiv.innerText ="HH:MM:SS\n" +hours + ":" + minutes + ":" + seconds; setTimeout('displayTime()', 1000); } displayTime(); </script> span class="start-tag">p> This is an Educational Purpose Clock. Only Works in Chrome and Internet Explorer. But not work in Mozilla FireFox. span class="start-tag">br> span class="start-tag">strong> Designed By: Double Diamond</strong> </p> </body> </html> <!-- Hey Guys and Girls.... Once again for the smiplicity u can remove all style from this code that is in style tag. To change the assignment you can change variables and funciton name and replace with ur own as u like. you can also change id names of divs. Am not it430's Student. But asuming that u know a little bit about code.
Posts: 9,583
Threads: 8,089
Joined: Apr 2011
span class="start-tag">html> span class="start-tag">head> span class="start-tag">title>JavaScript Click Here Button</title> </head> span class="start-tag">body style="text-align: center; margin: 50px;"> span class="start-tag">button onclick="alert('Java script is working')"> Click Here </button> span class="start-tag">br>By: Double Diamond </body> </html> <!-- Hey Student...... This is very Simple Question You can remove the Style from body tag and my name also

And I am using button tag you can use input tag to change the Assignment. After that Code will looks like this <input type=submit value="Click Here " onClick="alert('Javascript is Working')"> And one thing more don't forget to remove this comment starting with <!-- and ending with -->