Hallo,
hmm... nein da ist der type ja schon mit im Inputfeld festgelegt...
der muss erst type="password" setzen, wenn reingeklickt wurde
Aber vielleicht kann der IE keine zwei Anweisungen hinternander ausführen, wenn die auf einer Zeile stehen...
------------
Also daran liegt es auch nicht, der IE versteht das auch nicht in einem sauberen <script></script>. Und Firefox versteht es wiedermal...
------------
hmm.. in meiner reinen Freude das es Firefox so macht wie ich es will hab ich ganz und gar übersehen das type nur read-only ist. Da stell ich mir nun die Frage ob da mein Firefox ne macke hat und mich es beunruhigen sollte oder ob der IE lieber ebenso nachlässig sein sollte...
Dann muss ich wohl mit zwei <input> Feldern arbeiten
-----------
hihi
Nach bischen Überlegung und probieren hab ich nun endlich ne Lösung für IE,Opera sowie für Firefox und Mozilla.
|
Source code
|
1
2
|
<input class=\"mnu_login2\" name=\"txtPw\" size=\"12\" type=\"text\" value=\"Password\" onfocus=\"password('txt1_in')\" onblur=\"password('txt1_out')\">
<input class=\"mnu_login2\" style=\"display:none;\" name=\"txtPw2\" size=\"12\" type=\"password\" onfocus=\"password('txt2_in')\" onblur=\"password('txt2_out')\" value=\"\">
|
Firefox Version:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function password(typ)
{
if (typ=='txt1_in')
{
if (document.login.txtPw.value == 'Password')
{
document.login.txtPw.value='';
document.login.txtPw.type='password';
}
}
if (typ=='txt1_out')
{
if (document.login.txtPw.value=='' && document.login.txtPw.type=='password')
{
document.login.txtPw.value='Password';
document.login.txtPw.type='text';
}
}
}
|
IE Version:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
function password(typ)
{
if (typ=='txt1_in')
{
document.login.txtPw.style.display='none';
document.login.txtPw2.style.display='inline';
}
if (typ=='txt2_out')
{
if (document.login.txtPw2.value == '')
{
document.login.txtPw.style.display='inline';
document.login.txtPw2.style.display='none';
}
}
}
|
Da das ganze ne PHP Seite ist, war es auch kein Problem die Browser abzufragen.