Make delicious recipes!


HTML by itself is pretty much static.
Javascript brings dynamic content to HTML and also provides a way to manipulate the HTML programmatically.

Scripts can be included in HTML by making use of the <script> tag.
This has 2 flavors:
  1. In-place script:
        alert("Hello World");
  2. Reading script from file:
    <script src="url-for-js-file">

Example: A dynamic table can be built in Javascript as follows:

<div id="demoDiv">


    var demoDiv = document.getElementById("demoDiv");
    var tbl = document.createElement ("TABLE");

    demoDiv.appendChild (tbl);

    for (var i=0; i<3; i++)
        var row = tbl.insertRow(-1);
        for (var j=0; j<5; j++)
            var cell = row.insertCell(-1);
            cell.innerHTML = i+","+j;

For further reading, please see the Javascript article.

Like us on Facebook to remain in touch
with the latest in technology and tutorials!

Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Email: (Your email is not shared with anybody)

Facebook comments:

Site Owner: Sachin Goyal