Ver Mensaje Individual
  #6 (permalink)  
Antiguo 23/01/2013, 06:01
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Deshabilitar click raton???

Convengamos que si es por seguridad, con javascript no es muy seguro. Además la pregunta original decia bloquear el botón izq (asumamos que es el primario), pero sin indicar las circunstancias.
La técnica de una capa haciendo "overlay" con css, me parece sigue siendo más atractiva y no requiere de jQuery
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <title>Overlay</title>
  6. <style type="text/css">
  7. /*<![CDATA[*/
  8. html,body{
  9. height: 100%;
  10. margin: 0;
  11. padding: 0;
  12. border: none;
  13. }
  14. #ocultar{
  15. display: none;
  16. position:fixed;
  17. background:#000;
  18. width: 100%;
  19. height: 100%;
  20. opacity: 0.8;
  21. margin: 0;
  22. padding: 0;
  23. border: none;
  24. top:0;
  25. left:0;
  26. z-index: 999;
  27. text-align: center;
  28. padding-top: 200px;
  29. overflow:hidden;
  30. }
  31.  
  32. #cerrar{
  33. background: red;
  34. color: #FFF;
  35. border: solid red 2px;
  36. border-radius: 5px;
  37. position: absolute;
  38. z-index: 1000;
  39. text-align: center;
  40. width: 100px;
  41. padding: 8px;
  42. top: 40%;
  43. left: 50%;
  44. margin-left: -50px;
  45. cursor: pointer;
  46. }
  47.  
  48. /*]]>*/
  49. <script type="text/javascript">
  50. //<![CDATA[
  51.  
  52. function ocultar(){
  53. document.getElementById('ocultar').style.display ="block";
  54. document.oncontextmenu = new Function("return false");
  55. }
  56. function desactivar(){
  57. document.getElementById('hola').disabled = true;
  58. }
  59. //]]>
  60.  
  61. </head>
  62. <div id="ocultar">
  63. <div onclick="this.parentNode.style.display ='none';document.oncontextmenu= 'return true';" id="cerrar">mensaje...<br/><small>cerrar</small>
  64. </div>
  65. </div>
  66. <button onclick="ocultar();">generar error loguin</button>
  67. <h1>xxxx</h1>
  68. <h2>xxxxx</h2>
  69. <button onclick="desactivar()">input disable</button>
  70. <form action="#">
  71. <input type="text" value="hola" name="hola" id="hola" />
  72. </form>
  73. </body>
  74. </html>

Es crossbrowser

SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.