dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Scrpt not working very well

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Scrpt not working very well

    Hello All,
    I am working on this login page. And i have this script. The first part works very well. When I click the username textbox it cleanses it, if it looses focus and its blank the text "Username:" appears again if not it stays with the username.
    The second textbox Password does it if i dont include the propierty "type" bue if i also want to changee this propierty it does it until the second attempt. For both twxtboxes i run this script on click and onblur. for the problematic textbox if i click id does not cleans the text until I exit the textbox it clears it. Any ideas?

    function textboxfunctions(el) {
    var elemento = document.getElementById($(el).attr("id"));

    switch (elemento.id) {
    case 'txtUsername':
    if (elemento.value == 'Username:') {

    elemento.value = '';
    }
    else {
    if (elemento.value == '') {
    elemento.value = 'Username:';
    }
    }
    break;
    case 'txtPassword':
    if (elemento.value === 'Password:')
    elemento.type = 'password',
    elemento.value = '';

    else
    if (elemento.value === '')

    elemento.value = 'Password:',
    elemento.type = 'text';


    break;
    default:

    }



    }


    </script>

  2. #2
    Join Date
    Mar 2013
    Posts
    2
    I transferred the script to a .js file an now it works fine. Previously I had it in the page code.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles