CHANGE COLOR
  • Default color
  • Brown color
  • Green color
  • Blue color
  • Red color
CHANGE LAYOUT
  • leftlayout
  • rightlayout
SET FONT SIZE
  • Increase font size
  • Default font size
  • Decrease font size
Customise your homepage

Website Support India - Support for website related issues

Home News Javascript Introduction

Javascript Introduction

E-mail Print PDF
User Rating: / 0
PoorBest 

Declaring JavaScript

Adding JavaScript to a web page is actually surprisingly easy! To add a JavaScript all you need to add is the following (either between the <head></head> tags or between the <body></body> tags - I will explain more about this later):

<script language="JavaScript">

JavaScript

</script>

As you can see the JavaScript is just contained in a normal HTML tag set. The next thing you must do is make sure that the older browsers ignore it. If you don't do this the code for the JavaScript will be shown which will look awful.

There are two things you must do to hide the code from older browsers and show something instead:

<script language="JavaScript">
<!--Begin Hide

JavaScript

// End Hide-->
</script>
<noscript>

HTML Code

</noscript>

As you can see this makes the code look a lot more complex, but it is really quite simple. If you look closely you can see that all that has been done is that the JavaScript is now contained in an HTML comment tag. This is so that any old browsers which do not understand <script> will just think it is an HTML comment and ignore it.

Last Updated ( Tuesday, 27 April 2010 16:09 )  

Polls

Best Scripting language
 

Software Reviews

Dreamweaver CS5
website_support : dreamweaver_cs5
Best Website Developer and designing software
Photoshop
website_support_Photoshop CS5
Most famous website page desinging software 
Eclipse
website_support-Eclipse 
Open Source PHP IDE.