Archives for “JavaScript”

Recently I discovered that Firefox lets you override alert and confirm window object methods. I tried this with prototype and surprisingly it just worked! (Note that it is not tested in IE or Opera and others yet, but it also works in Safari). <div id="test" style="background:red;color:white;display:none;"></div> <script type="text/javascript"> window.confirm = function (s) { alert(s); }; window.alert = function (s) [...]


I hope the title is self-explanatory … Several times, in a symfony project or a project which runs with the help of the prototype library, some problems arise regarding the scope of certain javascripts variables declared inside ajax request (that can be theyselves declared within other ajax request). Usually , you need to access certain javascript varible [...]


Las cabeceras X-JSON salen de un modo misterioso en la documentacion de Prototype, e incluso en la de symfony. Pues bien, tiene utilidad, vienen muy bien para enviar datos desde la operacion ajax hecha en el servidor hasta la funcion javascript que se suele ejecutar en el status ‘complete’ Pero pasemos a un ejemplo:


Pegándome con el widget de Plaxo para obtener contactos de correo desde cuentas de servicios web públicos he necesitado sacar por un lado el nombre del “individuo” y por otro su dirección de email para insertarlo en unos controles de un formulario. Como no tengo ni idea de expresiones regulares, etc, etc, etc… me ha llevado [...]