Outbook

HTML+CSS+JS, Accesibilidad, PHP y más

Inicio que contiene a

Datos de búsqueda

Etiqueta ‘Web design’

Javascript: Click outside element

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';
}

Read at Closing a floating div layer Webdeveloper.com.

Datos del artículo:

CSS3: target-new property

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

  • window: opens in new window.
  • tab: opens in new tabof browser (the most interesting usage).
  • none.

Example:

div p a {target-new: tab;}

The link which fits the selector will open in new tab.

Know more

  • Original article in spanish: CSS 3: propiedad target-new
  • Datos del artículo:

    Javascript: get page dimensions (width and height)

    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)

    Datos del artículo:

    • Etiquetas: ,
    • Publicado en categorías: Sin categoría
    • Comentarios desactivados en Javascript: get page dimensions (width and height)

    How to detect the Internet Explorer version in Javascript

    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();}

    Know more

    Datos del artículo:

    Información del sitio