Implementation Method without writing value to the input Initial value _ javascript skills

Source: Internet
Author: User
For example, to create a most common input initial value, I used to write it in the input value. I want to write the initial value separately, so I am dumb and use & lt; span & gt; tag write, located on the input, so that the click and input get focus disappear 1. use the tag to write, locate on the input, and make it disappear from the click and input focal points.

For example, to create a most common input initial value, I used to write it in the input value. But one day the developer said that this would not work, and the value would be seven to eight % ...... @ The rest can only be said. Therefore, I want to write the initial value separately, so I am dumb. I will use the tag to write the initial value and locate it on the input so that the click and input get focus will disappear.

Words that must be firmly remembered. If you don't know what it is, you can make it directly. You are the most stupid person in the world !! I'm still trembling with my typing hands, and I can't forgive myself for that tiny mistake. For a lazy, stupid person. Put the correct words in what you want.

Previussibling searches for the previous node.

NextSibling searches for the next node.

Html

The Code is as follows:



Original Password


Css

. Password {position: relative ;}
. PassText {position: absolute; left: 5px; top: 0px; color: # a9a9a9; font-size: 14px ;}



Js, pay attention to the long and long word !!!!! If you make a spelling mistake, click it.

The Code is as follows:


Var CHECKON = {
ShowHelpInfo: function (idTa ){
Var pve = (idTa. previussibling. nodeType = 1 )? IdTa. previussibling: idTa. previussibling. previussibling;
Pve. style. display = 'none'
},
Hide: function (classN, id2 ){
Var idBox = document. getElementById (id2 );
ClassN. style. display = 'none ';
IdBox. focus ();
}
}


2. Use the background image method to add a background image to the input file, so that the image disappears when the image is focal points are obtained.

3.html 5 has a new attribute, the placeholder attribute, which will appear in the input consciously and appear in gray. However, it disappears only when the input is input. But html5, You know, ie8 is not supported.

The above problem is that the browser will remember the previously entered records. When the login page is opened again, the account password appears consciously. Yes, of course it is a good thing. But, for the previously set span label Positioning method, there will be a duplicate.

If a background image is used, it can be basically solved, but ie7 cannot.

Add the following code to the head header to clear the previous cached logon records:

The Code is as follows:




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.