faqts : Computers : Internet : Web : HTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

Has css to do with the java script.?

Nov 13th, 2006 05:18
Matt Chatterley, Prasanth Jose,


CSS - Cascading Style Sheets - contain the styling information for your
page (e.g. colours, font sizes, font types, width of elements).
JavaScript is a language which runs on the client side (in the web
browser), allowing you to manipulate the contents of the page, automate
some events, etc.
The only real relationship between the two is that you can alter the CSS
currently active on the page via JavaScript, e.g. If you have defined
two CSS classes "class_one" and "class_two", and you have a div tag on
the page with the id "div1", you could do:
if(i == 1)
{
  document.getElementById('div1').className = 'class_one');
}
else
{
  document.getElementById('div1').className = 'class_two');
}
to dynamically set the css class which is effective for the div, using
JavaScript.