HTML forms - enabling browers to ask for remembering the value of a text form?
I have a field that I've labeled 'password',开发者_运维技巧 and I'd like the browser to ask the user whether they want to store that password. How do I do this? Is there an HTML attribute to use?
For instance the HTML for the form would be:
<form action="" method="POST" name="form">
Enter password:
<input type="text" name="password" /><br />
A checkbox
<input type="checkbox" name="some_checkbox" value="Yes" /><br />
A textarea<br />
<textarea name="input_text" cols=40 rows=10></textarea><br />
<input type=submit value="Submit">
And I'd like the browser to prompt for storing the 'password' input.
You can't explicitly force the browser to show that dialog, but using the correct elements gives the browser a helping hint.
So make sure your password element has the type="password"
attribute.
This should do it:
<input type="password" name="password" />
Note the proper type
for the password box.
精彩评论