Created
August 10, 2011 14:30
-
-
Save rskull/1136916 to your computer and use it in GitHub Desktop.
入力案内スクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//入力案内出力 | |
function GidFm (id, on, out) { | |
var check = ''; | |
var gf = document.getElementById(id); | |
var gfv = gf.value; | |
gf.style.color = out; | |
if (gf.type == 'password') { | |
gf.type = 'text'; | |
check = 'pass'; | |
} | |
//フォーカスされたら消す | |
gf.onfocus = function () { | |
if (gf.value == gfv) { | |
gf.value = ''; | |
gf.style.color = on; | |
if (check == 'pass') { | |
gf.type = 'password'; | |
} | |
} | |
} | |
//元に戻す | |
gf.onblur = function () { | |
if (gf.value == '') { | |
gf.value = gfv; | |
gf.style.color = out; | |
if(check == 'pass') { | |
gf.type = 'text'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment