JS学习笔记 - 微博发布效果
2024-08-27 16:19:32
<script>
window.onload = function()
{
var oTxt = document.getElementById('txt1');
var oBtn = document.getElementById('btn1');
var oUl = document.getElementById('ul1'); oBtn.onclick = function()
{
// var aLi = oUl.getElementsByTagName('li'); // 补写:
var oLi=document.createElement('li');
// 先创建元素,再在后面用appendChild加给oUl // 赋值写反了! oTxt.innerHTML = oLi.value; // 前面用的是aLi,这里怎么表示单个li的值
oLi.innerHTML=oTxt.value;
oTxt.value=''; // if(aLi.length>0)
if(oUl.children.length>0)
{
// oUl.insertBefore(li, aLi[0])
oUl.insertBefore(oLi, oUl.children[0]);
}
else
{
// oUl.appendChild('li');
oUl.appendChild(oLi);
} var iHeight = oLi.offsetHeight; oLi.style.height='0'; // ??? startMove(oLi, {height: iHeight}, function (){
startMove(oLi, {opacity: 100});
// 调用的框架属性值用的json格式,所以这里要用花括号写。
}); // startMove(oLi, "height", iHeight, function()
// {
// startMove(oLi, "opacity", 100)
// },30); // 运动框架后面括号没有时间,定时器才有。
};
};
</script>
最新文章
- tinyXML的用法
- js如何判断一个数组
- 为什么没有选择sipml5
- js禁止复制页面文字
- Chrome扩展开发之三——Chrome扩展中的数据本地存储和下载
- Android:View中的performClick()触发条件
- 003--VS2013 C++ 多边形绘制
- iOS音效
- !! This tutorial was designed to help you with installation and configuration of OpenCV4Android SDK.
- 【JavaScript】JavaScript回调函数
- Redis中的关系查询(范围查询,模糊查询等...)
- caffe简易上手指南(一)—— 运行cifar例子
- Microsoft Windows Server 2008 R2 IIS7.5安装指南
- 将单链表的每K个节点之间逆序
- oracle中if/else
- js广告轮询效果
- 第十篇:Map/Reduce 工作机制分析 - 数据的流向分析
- Kali Linux Live USB初始化+使用日记
- leetcode日记 HouseRobber I II
- 51nod1236 序列求和 V3 【数学】
热门文章
- AI:OPENCV实现人脸的自动识别
- CSUOJ 1525 Algebraic Teamwork
- STM32的IO口的8种配置
- DataTable填充实体类返回泛型集合
- [Servlet]研究ServletContext对象
- SQl 行转列,列转行 (PIVOT,UPIVOT)
- powershell《语音报警系统》
- 认识Linux瘦客户机
- 【Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined) A】 Perfect Squares
- Android开源图表库XCL-Charts版本号公布及展示页