老师,用autocomplete怎么改变背景色
来源:2-8 编程练习
qq_倚楼听风雨_5
2019-12-06 17:34:24
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
/*input:-webkit-autofill{
-webkit-box-shadow:0px 0px 0px 1000px white inset;
}*/
</style>
</head>
<body>
<form autocomplete="on">
用户名<input name="user" type="text" class="text" /><br/>
密码<input name="password" type="text" class="text"/>
<input type="submit">
</form>
<script type="text/javascript">
var inputs = document.getElementsByClassName('text');
console.log(inputs);
for (var i = 0; i < inputs.length; i++) {
inputs[i].onclick = function () {
inputs[i].autocomplete = 'off';
};
}
</script>
</body>
</html>
1回答
好帮手慕言
2019-12-06
同学你好,可使用下方的方式实现,如下

目前高版本的谷歌浏览器背景颜色已经不是黄色了,同学可以不用太担心
如果我的回答帮到了你,欢迎采纳,祝学习愉快~
相似问题