Menu
IDC40 - Scripting
Scripting
The tags provided in HTML give a limited ability for users to interact with a web page. But we can insert programs (scripts) inside of HTML to make calculations and put out the results.
PHP
PHP is a common language used for programming web pages. The tool at w3Schools is an excellent tutorial.
<h1>My first PHP page</h1>
<?php echo "Hello World!"; ?> </body> |
In the example on the left, we can see the standard heading tag in HTML. Below it is a special tag for php.
The actual php code is: echo "Hello World!"; |
JavaScript
The JavaScript language is a standard language used for programming web pages. The tool at w3Schools is an excellent tutorial.
<p id="demo"></p>
<script> document.getElementById("demo").innerHTML = "My First JavaScript"; </script> |
In the example on the left, we can see the standard paragraph tag in HTML. We set the id attribute of it (like giving a variable name to be used later)
The <script> tag means that JavaScript is going to be coded. In this case, the actual JavaScript code is document.getElementById("demo").innerHTML = "My First JavaScript"; |