Fecha de publicación: 2009/11/05
Simply function to detect click event outside desired element:
document.onclick = function (e) {
e = e || event
var target = e.target || e.srcElement
var element = document.getElementById('id_element');
do {
if (element == target) {
// When clicked inside element, does nothing
return;
}
target = target.parentNode;
} while (target)
// When clicked outside element, makes an action.
element.style.display = 'none';
}
Fecha de publicación: 2007/12/22
The target-new CSS property allows the target of a link to be set to a new window or new tab in the browser. It is equivalent to the target HTML attribute.
It have three possible values
Example:
div p a {target-new: tab;}
The link which fits the selector will open in new tab.
Fecha de publicación: 2007/12/22
In order to get the page height:
document.body.scrollHeight;
And in order to get the page width:
document.body.scrollWidth;
More comprehensive at Javascript Get Page Height With Scroll (Webdev Entry)
Original article in spanish: Javascript: Halllar las dimensiones de la página (altura y anchura)
Fecha de publicación: 2007/12/22
It’s very easy:
var ieVer=/*@cc_on function(){ switch(@_jscript_version){ case 1.0:return 3; case 3.0:return 4; case 5.0:return 5; case 5.1:return 5; case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7; }}()||@*/0;
/*@cc_on opens the conditional, while @*/ closes it. The code inside conditional comment is only read by Internet Explorer.
The code inside conditional comment establishes that every Internet Explorer version returns a number. The 0 number is outside of the conditional comment, so that other browsers will take 0 value.
If we want a desired function works only in Internet Explorer 6 and older we write a condition which requires an equal or lower to 6 value for the ieVer value:
if (ieVer<=6) {executedFunction();}