Mostrando postagens com marcador javascript. Mostrar todas as postagens
Mostrando postagens com marcador javascript. Mostrar todas as postagens

sexta-feira, 7 de junho de 2013

Limit do TextArea


<html>
<body>
<script>
    function limitTextArea(field){
        //field = document.getElementById(field.id);
        var str = field.value;
        var newStr = "";
        var linhas = new Array();
        var replaceLine = false;
        linhas = str.split("\n");
        var cont = linhas.length;

        for (x in linhas){
            if(linhas[x].length > field.cols-2){
                linhas[x] = linhas[x].substring(0, field.cols);
                replaceLine=true;
            }
            if(x < field.rows){
                newStr += linhas[x] + "\n";
            }
        }

        if (cont > field.rows || replaceLine) {
            field.value = newStr.substring(0, newStr.length-1);
        }
        return cont <= field.rows;
    }
</script>
<textarea id="teste" rows=3 cols=3 onkeypress="return limitTextArea(this)">
</textArea><br><br>
</body>
</html>
Fonte: http://forum.imasters.com.br/topic/289857-maximo-de-linha-e-coluna-no-textarea/

segunda-feira, 5 de novembro de 2012

Teste de event Key Code Javascript






JavaScript Event KeyCode Test Page

JavaScript Event KeyCode Test Page

Input:
onKeyDown onKeyPress onKeyUp
event.keyCode
event.charCode
event.which

Notable Gotchas

  • Firefox and onKeyDown vs. onKeyPressed
  • Firefox and keyCode vs. charCode
  • Enter key and onKeyPress on Firefox vs. IE

fonte: http://www.asquare.net/javascript/tests/KeyCode.html


segunda-feira, 27 de agosto de 2012

Cache jQuery

AJAX cache problem in IE, AJAX cache issue IE

Disable Cache in jQuery

Best way to avoid caching is by disabling it through jQuery setup. Following code snippet does this:

$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false
});
Try to use this method of disabling cache in case you using different Ajax loading techniques such as.load(), .getJSON() etc.