输入(密码)onblr javascript bug internetexplorer 7和8
input(password) onblur javascript bug internet explorer 7 and 8
这是我输入的javascript内联代码
<input type="text" value="Please type username here..." onfocus="if (this.value == 'Please type username here...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Please type username here...';}" name="name1" id="username">
它可以在mozilla、IE9 Chrome中工作,但不能在IE7和IE8中工作,它显示文本而不是密码(星号)或隐藏值。
将placeholder
属性用于此行为。这样,在现代浏览器中就不需要任何支持此属性的JavaScript了。然后,您可以使用polyfill使其在IE9和旧版本的浏览器中工作。
你的HTML看起来像:
<input type="text" placeholder="e.g. myusername" name="username" id="username">
<input type="password" placeholder="e.g. hunter2" name="password" id="password">
我用jQuery插件格式制作了一个@placeholder
polyfill,您可以如下使用:
$('input').placeholder();
下面是一个演示:http://mathiasbynens.be/demo/placeholder正如您所看到的,它可以很好地处理textarea
和密码输入。
相关文章:
- 在这个使用hasOwnProperty的对象扩展程序中有一个错误,I'我不确定那个bug是什么,也不确定这个扩展
- window.open尽管被用户触发,但仍无法在InternetExplorer中工作
- Ajax调用在InternetExplorer中冻结UI,但在firefox中运行良好
- Socket.io客户端在使用名称空间时忽略端口[Bug?]
- angularjs formly submit bug in safari & IE 11
- Bug修复放弃了Firefox插件Wikilook
- “*[attribute ^="string”是如何/为什么是有效的querySelector?(JS bug
- HTML5 Canvas drawImage ratio bug iOS
- sharepointajax调用未在internetexplorer中显示
- PrependTo() bug
- Backbone.js bug?
- InternetExplorer:外部文本文件只能使用二进制格式
- vba截取internetexplorer链接点击
- jquery,why.data()在internetexplorer中不起作用
- Android的Bug:调试修复JS
- 在NodeJS网站中查找Bug
- SyntaxError: missing ) after argument list in fire bug
- IE11-Only Submit Bug
- jquery IE8 bug 中的 .on 方法
- 输入(密码)onblr javascript bug internetexplorer 7和8