开发者

HTML forms - enabling browers to ask for remembering the value of a text form?

开发者 https://www.devze.com 2023-03-05 19:02 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消