Tags: javascript

Sort by: Date / Title /

  1. 1 month ago by jacinmontava
    1. <script type="text/javascript">
    2. function pulsar(e) {
    3.   tecla = (document.all) ? e.keyCode : e.which;
    4.   return (tecla != 13);
    5. }
    6. </script>
    7. <!-- -->
    8. <form action="loquesea.asp" onkeypress = "return pulsar(event)">
    9. <input type="text" />
    10. <input type="submit" />
    11. </form>
  2. 1 month ago by jacinmontava
    1. function stopRKey(evt) {
    2. var evt = (evt) ? evt : ((event) ? event : null);
    3. var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    4. if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
    5. }
    6. document.onkeypress = stopRKey;
  3. 2 months ago by jacinmontava
    En los parámetros del flash o FLV incluir
    <param name="wmode" value="transparent">
    
    Ahora un paso MUY IMPORTANTE para que funcione en todos los navegadores
    
    Para que tambien funcione en Firefox y Opera, etc.incluir el codigo (wmode="transparent") dentro de la etiqueta EMBED, y quede algo así como:
    <embed src="miflash.swf" wmode="transparent" quality="high" etc etc.
  4. sponsorised links
  5. 4 months ago by aric
    html / javscript
    1. <input type="file" onchange="this.submit()" name="myfile" />
  6. 5 months ago by spirit
    When the location you want is in the center of the map, copy and paste this code into the location bar of your browser and press enter
    1. javascript:void(prompt('',gApplication.getMap().getCenter()));
  7. 6 months ago by spirit
    This little trick allows a Flash movie (swf) to find out the URL of the page in which it's embedded. Javascript must be enabled for this to work. if the window.location.href.toString method doesn't return a value then ExternalInterface.call will return null. Same thing happens when Javascript is disabled.
    1. // This little trick allows a Flash movie (swf) to find out the URL of the page in which it's embedded.
    2.  
    3. import flash.external.ExternalInterface;
    4.  
    5. var pageURL:String =
    6.         ExternalInterface.call('window.location.href.toString');
  8. 6 months ago by spirit
    if toFixed is not defined
    1. if (!num.toFixed)
    2. {
    3.  
    4.  Number.prototype.toFixed = function(precision) {
    5.      var power = Math.pow(10, precision || 0);
    6.      return String(Math.round(this * power)/power);
    7.  }
    8.  
    9. }
    10.  
    11. // OR
    12.  
    13.   Number.prototype.toFixed = function(precision)
    14.   {
    15.      var num = (Math.round(this*Math.pow(10,precision))).toString();
    16.      return num.substring(0,num.length-precision) + "." +
    17.             num.substring(num.length-precision, num.length);
    18.   }
  9. 6 months ago by jacinmontava
    1. <script language="JavaScript">
    2. function Abrir_ventana (pagina) {
    3. var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=690, height=400, top=100, left=80";
    4. window.open(pagina,"",opciones);
    5. }
    6. </script>
    7.  
    8. <body onLoad ="Abrir_ventana('pop.html')" >// abrirlo cuando carga la pagina
  10. 8 months ago by minus
    1. $("input:visible:enabled:first").focus();
  11. 8 months ago by dphiffer
    The idea here is that a single 'Page' object would manage the various defined classes that handle interaction on the page. When 'domready' fires, the Controllers object would do a set of searches for each known controller and establish an object for each element that matches the $$ query. For instance all elements with the CSS class 'JS_Calendar' would be controlled by corresponding objects derived from the Page.Calendar class.
    1. /*
    2.  
    3. Class: Controllers
    4.  
    5. This is a namespace for all the classes that control interactive behavior on the
    6. page. It also manages event messaging so that controllers can communicate with
    7. each other.
    8.  
    9. */
    10. var Controllers = new Class({
    11.  
    12.   Implements: Events,
    13.  
    14.   initialize: function(cssPrefix) {
    15.     this.controllers = [];
    16.     window.addEvent('domready', this.initializeControllers.bind(this, cssPrefix));
    17.   },
    18.  
    19.   initializeControllers: function(cssPrefix) {
    20.    
    21.     // After the page loads, search for elements with particular CSS classes
    22.     // that correspond to JavaScript behavior controllers.
    23.    
    24.     for (property in this) {
    25.       if ($type(this[property]) != 'class') {
    26.         continue;
    27.       }
    28.       dbug.log(property);
    29.       $$('.' + cssPrefix + property).each(function(el) {
    30.         try {
    31.           var Controller = this[property];
    32.           this.controllers.push(new Controller(el, this));
    33.         } catch(e) {
    34.           dbug.log(e.message);
    35.         }
    36.       }.bind(this));
    37.     }
    38.     this.fireEvent('onInitialize');
    39.    
    40.   }
    41.  
    42. });
    43.  
    44. dbug.enable();
    45. var Page = new Controllers('JS_');
    46.  
    47. // In another file, calendar.js
    48. Page.Calendar = new Class({
    49.   initialize: function(el, page) {
    50.     // ...
    51.   }
    52. });

First / Previous / Next / Last / Page 1 of 4 (32 posteets)