首页 > Web开发 > 详细

html动态编辑框

时间:2015-05-25 09:42:56      阅读:229      评论:0      收藏:0      [点我收藏+]

简述:

随着在输入框中增加字符,动态矿高度增加(IE9及以上 chrome  firefox)

由于IE8 不支持oninput函数,所以不能实现此效果

事件函数:

function feedDivOnInput(obj){
    obj.style.height=30+px;
    obj.style.height=obj.scrollHeight+px;
}

function feedTextAreaOnInput(obj){
    obj.style.height=30+px;
    obj.style.height=obj.scrollHeight+px;
}

html标签

            <div class="discusstexarea_div c_9 mb" oninput="javascript:feedDivOnInput(this)">
                <textarea name="postMsg" class="discusstextarea  c_9" oninput="javascript:feedTextAreaOnInput(this)">我的评论...</textarea>
            </div>

效果:

单行,

技术分享

多行,

技术分享

html动态编辑框

原文:http://www.cnblogs.com/zhujiabin/p/4527031.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!