Comentario: Este artículo presenta principalmente el atributo HTML 5 Entrada de poseedor de la posición para servir perfectamente como IE. Amigos que lo necesitan pueden referirse a él
Recuerde hacer referencia a la biblioteca de clases jQuery$ (documento) .Ready (function () {
if ($ .browser.msie)
$ ("Entrada: texto, entrada: contraseña"). Cada (function () {
var $ placeHOLDER = $ (this) .Attr ("Plazhander");
var $ width = $ (this) .css ("ancho");
var $ id = $ (this) .attr ("id");
var $ altura = parseInt ($ (this) .css ("altura")) + 6 + "px";
var $ fontSize = $ (this) .css ("font-size");
var $ fontweight = $ (this) .css ("font-weight");
var $ lineHeight = $ altura;
if ($ (this) .css ("Line-Height")! = "Normal") {
$ lineHeight = parseInt ($ (this) .css ("line-height")) + 6 + "px";
}
if ($ placeHOLDER! = Undefined) {
$(this).after("<span class=/"placeholder ph_" + $id + "/" style=/"width:" + $width + ";line-height:" + $lineHeight + ";height:" + $height + ";font-weight:" + $fontWeight + ";margin-left:-" + $width + ";font-size:" + $fontSize + "/">" + $ PLODHOLDER + "</span>");
}
$ (this) .bind ("keyUp", function () {
if ($ (this) .val () == "") {
$ (this) .Parent (). Find (". Ph_" + $ id) .css ("Display", "Inline-Block");
}
demás {
$ (this) .parent (). find (". Ph_" + $ id) .css ("visualización", "ninguno");
}
});
});
$ (". Posición de posición"). Live ("Click", function () {
$ (this) .prev (). focus ();
});
});
Llamada de la página
<input type = "text" placeHolder = "Estoy solicitando que el contenido sea normal" />
<input type = "text" placeHolder = "Estoy indicando el ancho y la altura del contenido" />
<input type = "text" placeHolder = "Estoy solicitando contenido tengo otros estilos" />
<input type = "text" placeHolder = "puede probar otros" />
estilo
<style type = "text/css">
.PlaceHolder {display: en línea bloque; color: gris; vertical-align: top; desbordamiento: oculto;}
</style>