Комментарий: Эта статья в основном представляет атрибут HTML 5 Placeholder, чтобы идеально служить IE. Друзья, которые это нужно, могут ссылаться на это
Не забудьте ссылаться на библиотеку класса JQUERY$ (document) .ready (function () {
if ($ .browser.msie)
$ ("input: text, input: пароль"). Каждый (function () {
var $ Placeholder = $ (this) .attr ("Placeholder");
var $ width = $ (this) .css ("ширина");
var $ id = $ (this) .attr ("id");
var $ height = parseint ($ (this) .css ("height")) + 6 + "px";
var $ fontsize = $ (this) .css ("размер шрифта");
var $ fontweight = $ (this) .css ("font-weight");
var $ lineheight = $ height;
if ($ (this) .css ("line-height")! = "Нормальный") {
$ lineheight = parseint ($ (this) .css ("line-height")) + 6 + "px";
}
if ($ Placeholder! = Undefined) {
$ (this) .after ("<span class =/" Placeholder ph_ " + $ id +"/"style =/" width: " + $ width +"; line-height: " + $ lineheight +"; hight: " + $ height +"; font-weight: " + $ fontweight +"; маржа-left:-" + $ width +»; $ Placeholder + "</span>");
}
$ (this) .bind ("keyup", function () {
if ($ (this) .val () == "") {
$ (this) .parent (). Найти (". PH_" + $ id) .css ("Display", "inline Block");
}
еще {
$ (this) .parent (). find (". ph_" + $ id) .css ("display", "none");
}
});
});
$ (". заполнитель"). Live ("click", function () {
$ (this) .prev (). Focus ();
});
});
Страница звонок
<input type = "text" Placeholder = "Я предлагаю контенту нормальное" />
<input type = "text" Placeholder = "Я предлагаю ширину и высоту контента" />
<input type = "text" Placeholder = "Я предлагаю контент, у меня есть другие стили" />
<input type = "text" Placeholder = "Вы можете попробовать другие" />
стиль
<стиль типа = "text/css">
. Placeholder {Display: Inline Block; Color: Grey; Vertical-Align: Top; Overflow: Hidden;}
</style>