http://jsfiddle.net/samertaha/Y2ULV/
kindly see the visibility sample up here ,
in the first rows of the javascript , they declared some variables , but i couldnt understand why they declared a variable named toggle with no value or type.
thanks.

// Get references to page elements and create a link dynamically
    var intro = document.getElementById('intro'),
        dets = document.getElementById('details'),
        a = document.createElement('a'),
        toggle; <- here i cant figure why they declared toggle ... !!!

the whole example in jsfiddle is an example showing how we can use the visibility css proporty.....

thanks

forget the first question i understand now why they declared the toggle variable.....
but now i cant understand why they populated the anchor this way :
a.appendChild(document.createTextNode('Hide details'));
why not this way with the innerHTML method ???!!!
a.innerHTML = 'View details';
thanks

It's easier to follow what they did in code. They easily could have made the entire anchor tag with innerHTML, but chose to be explicit for the sake of readability.