Wednesday, August 15, 2012

HTML Scripts

Internet is a client-server model.So scripting is needed both in the front end and the back end.The front end is what the user views (and so it must be attractive and organised) and the back end is to handle the clients request (and need not be necessarily attractive ).
     HTML Scripting is very important if you want to make your webpage dynamic.The word dynamic includes image manipulation ,form validation ,adding external plugins and much more.To define a script in your webpage ,the <script>  tag is used.
    The are a few scripting languages that facilitate the front end management and one of them is javascript.This predominantly used client side scripting language is capable of even handling HTML elements .Moreover the advantage is that they are web safe and will not crash your device in case of failure.
 The back end scripting languages like php and facilitates the communication between the client and the server.we will be learning these languages in detail soon (but for now i'll be using javascript for all the examples).

 <script type="text/javascript">
 document.write("Hello World")

The output will be Hello World.But if the browser does not support javascript what do you think will happen?.Try it out.

To solve that issue it is a must to use <noscript> along with your script tag.

<noscript>Sorry,your browser does not support javascript.</noscript>

But how does it handle HTML elements?.Did you get this doubt?.
 Consider a Textfield with its id attribute as id="txt1".
 <script type="text/javascript">
  document.getElementById("txt1").value="Web designing";

See what happens and comment.Stay Tuned.


Post a Comment