beccalouwho
07-01-2004, 04:26 PM
the form is a user name and password login.
the fields both begin with a value (USER ID) and (PASSWORD) and should switch to whatever value the user enters (this doesn't happen for password in Safari)
the fields also begin grey and turn black when clicked ( this doesn't work in Safari)
The problem is on the mac platform (everything works fine on pc)
In Safari, the password field keeps its initial PASSWORD value.
and in IE on Mac the field doesn't change color, or type(****)
I'm not as worried about the IE problem as I am about the Safari problem
I hope that was all clear.
now here is the code:
<script language="JavaScript" type="text/javascript">
<!--
function changeType(input){
if(input.value == 'PASSWORD'){
txtPassword = document.createElement('input');
txtPassword.name = 'txtPassword';
txtPassword.type = 'password';
input.parentNode.insertBefore(txtPassword,input);
input.parentNode.removeChild(input);
txtPassword.size='12.5';
txtPassword.focus();
txtPassword.style.color='black';
} else {
txtPassword.select();
}
}
function validateFields (formObj){
// size of form is currently 2 items any additions need to be accounted for
if(document.collection_order.txtLogin.value == "")
{
alert ('The following field is empty: "User ID"');
document.collection_order.txtLogin.focus();
return false;
}
if(document.collection_order.txtPassword2.value == "" && (document.collection_order.txtLogin.value.indexOf('@') < 0 || document.collection_order.txtLogin.value.indexOf('.') < 0))
{
alert ('The following field is empty: "Password"');
document.collection_order.txtPassword2.focus();
return false;
}
}
function FormSubmit2(){
if(document.collection_order.txtLogin.value == "")
{
alert ("Please enter your primary email into the User ID!");
document.collection_order.txtLogin.focus();
return false;
}else{
document.collection_order.submit();
}
}
function FormSubmit(){
document.collection_order.submit();
}
//-->
</script>
</head>
<body>
<form action="http://hq.ssrn.com/Pub_Login.cfm?function=Login"
method="post"
target="_top"
onsubmit="return validateFields('document.collection_order.elements')"
name="collection_order"
>
<br/>
<input
style="color: #999; height: 20px; font-size: 12px;"
value="PASSWORD"
name ="txtPassword"
size="12"
onclick="changeType(this)"
onfocus="this.style.color='black';"
/>
<input
name="Process"
type="submit"
value="Go"
/>
</form>
</body>
</html>
the fields both begin with a value (USER ID) and (PASSWORD) and should switch to whatever value the user enters (this doesn't happen for password in Safari)
the fields also begin grey and turn black when clicked ( this doesn't work in Safari)
The problem is on the mac platform (everything works fine on pc)
In Safari, the password field keeps its initial PASSWORD value.
and in IE on Mac the field doesn't change color, or type(****)
I'm not as worried about the IE problem as I am about the Safari problem
I hope that was all clear.
now here is the code:
<script language="JavaScript" type="text/javascript">
<!--
function changeType(input){
if(input.value == 'PASSWORD'){
txtPassword = document.createElement('input');
txtPassword.name = 'txtPassword';
txtPassword.type = 'password';
input.parentNode.insertBefore(txtPassword,input);
input.parentNode.removeChild(input);
txtPassword.size='12.5';
txtPassword.focus();
txtPassword.style.color='black';
} else {
txtPassword.select();
}
}
function validateFields (formObj){
// size of form is currently 2 items any additions need to be accounted for
if(document.collection_order.txtLogin.value == "")
{
alert ('The following field is empty: "User ID"');
document.collection_order.txtLogin.focus();
return false;
}
if(document.collection_order.txtPassword2.value == "" && (document.collection_order.txtLogin.value.indexOf('@') < 0 || document.collection_order.txtLogin.value.indexOf('.') < 0))
{
alert ('The following field is empty: "Password"');
document.collection_order.txtPassword2.focus();
return false;
}
}
function FormSubmit2(){
if(document.collection_order.txtLogin.value == "")
{
alert ("Please enter your primary email into the User ID!");
document.collection_order.txtLogin.focus();
return false;
}else{
document.collection_order.submit();
}
}
function FormSubmit(){
document.collection_order.submit();
}
//-->
</script>
</head>
<body>
<form action="http://hq.ssrn.com/Pub_Login.cfm?function=Login"
method="post"
target="_top"
onsubmit="return validateFields('document.collection_order.elements')"
name="collection_order"
>
<br/>
<input
style="color: #999; height: 20px; font-size: 12px;"
value="PASSWORD"
name ="txtPassword"
size="12"
onclick="changeType(this)"
onfocus="this.style.color='black';"
/>
<input
name="Process"
type="submit"
value="Go"
/>
</form>
</body>
</html>