码迷,mamicode.com
首页 > Web开发 > 详细

js运动 运动效果留言本

时间:2015-03-19 00:34:03      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
#ul1 { margin: 0; position: absolute; right: 10px; top: 8px; width: 700px; height: 500px; border: 1px solid #000; padding: 10px; overflow: hidden;}
li { line-height: 28px; border-bottom: 1px dotted #000; list-style: none; word-break: break-all; overflow: hidden;}
</style>
<script src="move.js"></script>
<script>
/*
先写出没有运动的效果,然后把赋值变成运动形式
*/
window.onload = function() {
    
    var oContent = document.getElementById(‘content‘);
    var oBtn = document.getElementById(‘btn‘);
    var oUl = document.getElementById(‘ul1‘);
    
    oBtn.onclick = function() {
        
        var oLi = document.createElement(‘li‘);
        oLi.innerHTML = oContent.value;
        
        if ( oUl.children[0] ) {
            oUl.insertBefore( oLi, oUl.children[0] );
        } else {
            oUl.appendChild( oLi );
        }
        
        //var iHeight = oLi.offsetHeight;
        var iHeight = parseInt( css(oLi, ‘height‘) );
        
        oLi.style.height = ‘0px‘;
        oLi.style.opacity = ‘0‘;
        oLi.style.filter = ‘alpha(opacity=0)‘;
        
        startMove(oLi, {
            height : iHeight,
            opacity : 100
        });
        
    }
    
}
</script>
</head>

<body>
    <textarea id="content" rows="10" cols="50"></textarea>
    <input type="button" value="留言" id="btn" />
    <ul id="ul1"></ul>
</body>
</html>

 

js运动 运动效果留言本

标签:

原文地址:http://www.cnblogs.com/mayufo/p/4349108.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!