`
haohappy2
  • 浏览: 326286 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

write a table using javascript dom

阅读更多
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml">   
<head>   
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   
<title>javascript dom测试</title>   
<script language="javascript">   
function createTable()   
{   
    var $=document;   
    var table=$.createElement("table");   
    table.bgColor="gray";   
    table.width="50%";   
    table.border=0;   
    table.cellSpacing=1;   
    var tbody=$.createElement("tbody");   
       
    table.appendChild(tbody);   
       
    for(var m=0;m<5;m++)   
    {   
        var tr=tbody.insertRow(m);   
        for( var n=0;n<8;n++)   
        {   
            var td=tr.insertCell(n);   
            td.innerHTML= (m+1)+","+(n+1) ;   
            td.bgColor="white";   
            td.height=25;   
        }   
    }   
    document.body.appendChild(table);   
}   
   
</script>   
</head>   
   
<body onload="createTable()">   
</body>   
</html>  

 

分享到:
评论

相关推荐

    JavaScript Functional Programming for JavaScript Developers (PDF, EPUB, MOBI)

    The third module, Functional Programming in JavaScript, will help you to write real-world applications by utilizing a wide range of functional techniques and styles. It explores the core concepts of ...

    JavaScript.Novice.to.Ninja.2nd.Edition

    JavaScript is a must-have skill for all web developers. [removed] Novice to Ninja is a fun, practical, and comprehensive guide to the modern usage of this deceptively powerful language. ...

    [removed] Moving to ES2015 (AZW3格式)

    You will gain a concrete understanding of variable scoping, loops, and best practices on using types and data structures, as well as the coding style and recommended code organization patterns in ...

    D3.js 4.x Data Visualization - Third Edition

    Write modern JavaScript using ES2017 and Babel Explore the basics of unit testing D3 visualizations using Mocha and Chai Write and deploy a simple Node.js web service to render charts via HTML Canvas ...

    Deliver.Audacious.Web.Apps.with.Ember2

    Use the Ember CLI to build your app using module-focused JavaScript classes with a clear project structure. Learn how to use Ember's routing classes to organize your app, write web components that ...

    jQuery.Essentials.

    Because it is a library of predefined functions, all you need to start using jQuery is a working knowledge of the syntax and a reference for the functions available to you. This practical guide ...

    Knockout API 中文版

    Just represent your items as a JavaScript array, and then use a foreach binding to transform this array into a TABLE or set of DIVs. Whenever the array changes, the UI changes to match (you don’t ...

    LotusDomino学习笔记(400页涵盖代理和公式使用)

    95. Using the DOM to replace "No documents found" 213 96. What you need and want to know about errors 217 97. Processing multiple documents from a view 221 98. Forcing attachments to always download ...

    Lotus Domino WEB详细 学习笔记

    95. Using the DOM to replace "No documents found" 213 96. What you need and want to know about errors 217 97. Processing multiple documents from a view 221 98. Forcing attachments to always ...

    Dart.Essentials.1783989602

    Some previous experience with OOP programming in other languages and a good knowledge of JavaScript are assumed. In Detail The Dart programming language can be used for both client- and server-side ...

    c#实现无刷新的DropdownList联动效果.pdf

    var oDoc = new ActiveXObject("MSXML2.DOMDocument"); oHttpReq.open("POST", "webform6.aspx?state="+state, false); oHttpReq.send(""); result = oHttpReq.responseText; oDoc.loadXML(result); items = ...

    html表格导出到excel

    这个过程通常涉及DOM操作、JSON序列化和文件对象的创建。 3. `js-xlsx`库示例: 使用`js-xlsx`,可以先解析HTML表格,然后创建一个工作簿对象,最后将其导出为Excel文件。下面是一个基本示例: ```javascript ...

    LotusDomino学习笔记.doc

    Formatting a Notes view in HTML table for WEB - **格式化方法**: 通过自定义视图的列公式或使用LotusScript来将Notes视图格式化为HTML表格。 #### 49. Jump to the end of a view (web agent) - **跳转方法**: ...

Global site tag (gtag.js) - Google Analytics