View RSS Feed

keyboard

  1. Scroll to Top Script

    Here's my alternative to the ddscript Jquery Scroll to Top Control V1.1

    scroll_to_top.js

    Code:
    $.fn.scroll_to_top = function(userOptions) {
    	var check_scroll = 0;
        var defaultOptions = {
    		image : 'jump_to_top.png',
    		image_height : '6%',
    		image_width : '3%',
    		scroll_distance : 200,
    		scroll_location : 0,
    		scroll_speed : 600,
    		button_animate_speed : 200,
    		button_animate_type : 'fade',
    ...
    Tags: javascript Add / Edit Tags
    Categories
    Uncategorized
  2. Show plain text in a password field

    I was browsing the internet and came across this tecnique and thought it was rather cool.

    To make plain text show in a password field, you need the following form -

    HTML Code:
     <form>
     <input type="text" name="passwordPlain" id="passwordPlain" value="Password" onfocus="swapPasswordBoxes('click')" style="display:none;"/>
     <input type="password" name="password" id="password"
    ...

    Updated 06-08-2012 at 11:23 PM by keyboard (swapped onclick for onfocus)

    Categories
    Post a JavaScript
  3. document.getElementById shortcut

    I'm amazed at how many people don't use a very simple shortcut for document.getElementById. This is for all the people who don't use a javascript library like jQuery.

    All you have to do is include this code somewhere on your page

    Code:
    function $(element) {
    return document.getElementById(element);
    }
    Then when you want to use document.getElementById('id'); just type $('id'); instead.

    Example

    Code:
    <html>
    ...
    Categories
    JavaScript & Ajax