Saturday, November 14, 2009

Creating Still background image for a web page through CSS

If you want a background image that remains still while scrolling the web page window, you can do it in few simple steps.

Create a Class in style-sheet having properties:-
1)background-attachment : fixed;
2)background-repeat : no-repeat;
3)background-image : URL (URL of the image);

now use that class in the body tag.

Monday, November 9, 2009

changing CSS class name of an html tag through javascript.

if we want to change the class name from "abc" to "xyz" of a div tag having attribute id="a" through javascript and these classes are defined in stylesheet then following is the javascript code.

javascript code:

function ChangeClass(id,class)
{
document.getElementById(id).className=class;
}

ChangeClass('a','xyz');