This script shows you the way functions are used in JavaScript. The following script shows you:
- How to declare functions.
- How to call the functions you have declared.
- How to change CSS properties of an element with js.
- The use of inbuilt function alert().
Click me to run this Script.
Script & HTML Code:
<body>
<p id="idp"onclick="alertfn()" onmouseover="mpointer()">
<b><u>Click me to run this Script.</u></b>
</p>
<script type="text/javascript">
<!--
function alertfn(){
alert("This is the Alert box!!!\nClick OK or CLOSE the window to go back!!");
}
function mpointer(){
idp.style.cursor="pointer";
}
-->
</script>
</body>
No comments:
Post a Comment