JavaScript
文章平均质量分 74
___________超
这个作者很懒,什么都没留下…
展开
-
JavaScript 动态增加行~
JS代码: window.onload = function() { var add = $('add'); var del = $('del'); var i=1; add.onclick = function() { var tableObject = new Object(); var isneed = true; tableObject = $('Clo原创 2011-11-08 08:59:25 · 644 阅读 · 0 评论 -
JS过滤空白文件节点
过滤空白文件 window.onload = function() { var nodes = document.body.childNodes; alert (nodes.length); //IE下显示2 FIREFOX显示5,原因有空白文件 nodes = filterSpaceNode(nodes); alert(nodes.leng原创 2011-11-08 16:00:25 · 1443 阅读 · 0 评论 -
表单笔记
//input 框中的 defaultValue 指 输入内容 //select 将input框中的内容全部选中 window.onload = function() { var fm = document.getElementById('fm1'); //通过ID获取 form var t = fm.textInput; //通过name 获取 fm.原创 2011-11-08 19:28:49 · 511 阅读 · 0 评论 -
一个页面中执行两个window.onload函数
1.问题描述: 当一个HTML页面中加载了两个window.onload=function() {};函数时,页面只会执行第二个window.onload里面的内容 如下,结果显示2: test window.onload = function() { alert('1'); }; 表格 window.onlo原创 2011-11-09 19:37:41 · 7246 阅读 · 1 评论 -
JS表格的学习笔记
test window.onload = function() { var table = document.getElementById('table'); //alert(table.caption.innerHTML); //table.caption:直接获取caption对象 //alert(原创 2011-11-09 18:05:49 · 764 阅读 · 0 评论 -
getAttribute,appendChild,removeChild,replaceChild,insertBefore 自定义函数
标题中的三个函数的优化: 1.getAttribute 因getAttribute在IE与Firefox上有会区别,比如class,for上面,获取到的值不一样 2.appendChild只能每次添加一个,不能添加多个 3.removeChild只能每次移除一个,不能移除多个 4.replaceChild,insertAfter(与insertBefore对应) 为了兼容,因此创建此函原创 2011-11-08 18:23:30 · 920 阅读 · 0 评论 -
JS两种增加SELECT 下的option方法
第一种方法: window.onload = function() { var opt = document.createElement('option'); opt.appendChild(document.createTextNode("上海")); opt.setAttribute("value","C3"); sel.appendChild(opt); };原创 2011-11-09 08:21:05 · 8399 阅读 · 0 评论