javascript 实现Tab滑动
先给出基本的HTML文件:
<ul>
<li id="m01"></li>
<li id="m01"></li>
<li id="m01"></li>
</ul>
<div>
<div id="C01"> </div>
<div id="C02"> </div>
<div id="C03"> </div>
</div>
下面是javascript代码:
function scrollMenu()
{
} /*创建一个类*/
scrollDiv.prototype =
{
sd:function(menus, divs, openClass, closeClass)
{
_this = this;
for(var i=0; i<menus.length; i++)
{
_this.$(menus[i]).value = i;
_this.$(menus[i]).onmouseover = function()
{
for(var j=0; j<menus.length; j++)
{
_this.$(menus[i]).className = closeClass;
_this.$(divs[i]).style.display = "none";
}
_this.$(menus[this.value]).className = openClass;
_this.$(divs[this.value]).style.display = "block";
} /*闭环处理*/
}
},
$:function(obj)
{
if(typeof(obj) == "string")
return document.getElementById(obj);
return obj;
} /*此处不要添加逗号,否则IE不支持*/
}
注:有空会完善。
相关文档:
在对程序进行性能测试时需要考虑到不同规模以及不同算法的效率的不同
下面的网页是一个对排序算法的性能测试,规模就是数组的长度,而测试的两个函数分别是手动实现的快速排序算法和javascript内置的排序函数。
<!DOCTYPE window PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- ......
首先在body中加入以下HTML内容:
<div id="panel">
<div id="top">
<ul id="menu">
<li id="1">Home</li>
&nbs ......
to make a note that I love JavaScript. This article is only meant for some fun, and for us to be aware of some its short-comings.
1. The Name. JavaScript is NOT Java
We'll start with a fun jab at the name choice. While it was originally called Mocha, and then LiveScript, it was later changed to J ......
选择元素:document.getElementsByTagName,document.getElementsById,document.getElementsByName。
firstChild,lastChild,nextSibling,previousSibling
创建元素:document.createElement(),appendChild();
删除元素:removeC ......
Javascript里面分模式对话框和非模式对话框,其实两者区别就是在对话框被关闭之前用户能否在同一页面的其他地方进行工作。比如“打开文件”对话框便是典型的模式对话框,在你对这个对话框做出动作才能对打开该对话框的程序进行其他操作,而非模式对话框则不必。
模式对话框:showModalDialog
非模式对话框:sho ......