校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > HTML 5 input placeholder 屬性如何完美兼任ie

HTML 5 input placeholder 屬性如何完美兼任ie

熱門標簽:百度地圖標注為什么總是封號 咸陽穩定外呼系統軟件 智能芯電話機器人 地圖標注柱狀圖 怎么做百度地圖標注 400開頭的電話好申請不 臨海地圖標注app 四川移動電銷外呼客戶管理系統 小朱地圖標注
記得引用jquery 類庫

復制代碼
代碼如下:

$(document).ready(function () {
if ($.browser.msie)
$("input:text,input:password").each(function () {
var $placeholder = $(this).attr("placeholder");
var $width = $(this).css("width");
var $id = $(this).attr("id");
var $height = parseInt($(this).css("height")) + 6 + "px";
var $fontSize = $(this).css("font-size");
var $fontWeight = $(this).css("font-weight");
var $lineHeight = $height;
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 + "\">" + $placeholder + "</span>");
}
$(this).bind("keyup", function () {
if ($(this).val() == "") {
$(this).parent().find(".ph_" + $id).css("display", "inline-block");
}
else {
$(this).parent().find(".ph_" + $id).css("display", "none");
}
});
});
$(".placeholder").live("click", function () {
$(this).prev().focus();
});
});

頁面調用

復制代碼
代碼如下:

<input id="n1" type="text" placeholder="我是提示內容正常" />

<input id="n2" type="text" placeholder="我是提示內容寬高" style="width:100px;height:100px;" />

<input id="n3" type="text" placeholder="我是提示內容我有其他樣式" / style="width:300px;height:40px;font-weight:bold;">

<input id="n4" type="text" placeholder="還可以嘗試下其他的" />


樣式

復制代碼
代碼如下:

<style type="text/css">
.placeholder {display:inline-block;color:gray;vertical-align:top;overflow:hidden;}
</style>

標簽:公主嶺 陜西 平頂山 黃石 平涼 黃石 山南 南平

巨人網絡通訊聲明:本文標題《HTML 5 input placeholder 屬性如何完美兼任ie》,本文關鍵詞  HTML,input,placeholder,屬性,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《HTML 5 input placeholder 屬性如何完美兼任ie》相關的同類信息!
  • 本頁收集關于HTML 5 input placeholder 屬性如何完美兼任ie的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 霍州市| 博兴县| 海南省| 陆河县| 靖宇县| 宝鸡市| 钟山县| 鲁山县| 兰州市| 滦平县| 萨迦县| 南充市| 泰兴市| 新巴尔虎右旗| 萝北县| 黔江区| 安龙县| 石渠县| 固阳县| 灵璧县| 房产| 乐安县| 崇义县| 榕江县| 木兰县| 鄂州市| 类乌齐县| 四川省| 乌拉特前旗| 姚安县| 聂拉木县| 盐亭县| 原平市| 临城县| 卢氏县| 德兴市| 新绛县| 南召县| 九江市| 新化县| 台中市|