WEEK 6 - Introduction to Java Script

Java script is a document help the web designer to build more functional and interactive website. For example, popup window, alert message, form validation, etc. are common use by the developer.

In this week, our lecturer teach us on how to form a java script in html document.
First, we use this code from lecturer slide.

Exercise 1
INPUT:
<html><head><title> JAVA SCRIPT</title></head>
<body>
<h1> Welcome to SMMTC </h1>
 This is HTML section....
</body>
</html>
<script type="text/javascript">
  window.alert("welcome to JavaScript!");
</script>
OUTPUT:
Exercise 2
INPUT:
<html><head><title> JAVA SCRIPT</title>
<script type="text/javascript">
  function showText() {
      window.alert("welcome to JavaScript!");   }
</script></head>
<body  onload="showText();">
<h1> Welcome to SMMTC </h1>
 This is HTML section....

</body></html>
OUTPUT:
Exercise 3
INPUT 
<html><head><title> JAVA SCRIPT Tab</title>
<h1> Welcome to SMMTC </h1></head>
<body>
 Example of JavaScript....
</body>
</html>
<script type="text/javascript">
  function showHide(show, hide) {    document.getElementById(show).style.display="block"; document.getElementById(hide).style.display="none";  }</script>
<p id="tab1">
   Tab 1 - Welcome to STIV3013
</p>
<p id="tab2"  style="display: none;"> 
   Tab 2 - WWW Programming
</p>
<input type="button" value="Tab 1"
 onclick="showHide('tab1','tab2');" />
<input type="button" value="Tab 2"

 onclick="showHide('tab2','tab1');" />
OUTPUT :



Comments

Popular posts from this blog

WEEK 7 - Introduction to PHP

WEEK 9 - PHP Exercise