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 Test  </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>
分类:Web 时间:2010-05-28 人气:246
分享到:
blog comments powered by Disqus

相关文章

  • servlet, page directives, meta three of the Content-Type of the differences and similarities 2009-03-25

    1. A prelude to the following servlet can display Chinese? public class SimpleServlet extends HttpServlet ( public void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException ( resp.setContentType ( "tex

  • script标签属性type与language使用选择 2015-04-25

    很多使用javascript的朋友都有着这样一个问题:script标签属性type与language使用应如何选择,为解决此疑惑,本文详细整理了一下,需要的朋友可以参考下 被人问起一个问题: <script language = "JavaScript"> <script type="text/javascript"> <script> 这三个标签的使用有什么区别? 虽然一直在用,却也没有好好去弄清楚,这里详细说明一下。 查阅一些资料,主要是浏览器支持问题。t

  • http content-type and file type of correspondence 2008-11-18

    Because reptiles do, so http head made some research, in particular content-type. 【2008-8】 1, http content-type and file type of correspondence ".*"=" application / octet-stream " ".001" = "Application/x-001" "

  • Content-type header in the types of 2010-04-22

    Content-type description: 'Hqx' -> 'application/mac-binhex40', 'Cpt' -> 'application / mac-compactpro', 'Doc' -> 'application / msword', 'Bin' -> 'application / octet-stream' ...

  • drupal theme: Design of page layout according to content type 2010-09-08

    By the Evance on Monday, 2007-12-24 08:54 text published sources: Customising the full page layout and sections based on node type Translation: Evance | drupal theme: Design of page layout in accordance with the content type description: This article desc

  • nginx gzip duplicate MIME type "text / html" 2010-09-14

    Instruction [# Gzip gzip] [# Gzip_buffers gzip_buffers] [# Gzip_comp_level gzip_comp_level] [# Gzip_min_length gzip_min_length] [# Gzip_http_version gzip_http_version] [# Gzip_proxied gzip_proxied] [# Gzip_types gzip_types] After the upgrade to the l

  • http content-type Daquan 2010-10-27

    http://www.utoronto.ca/webdocs/HTMLdocs/Book/Book-3ed/appb/mimetype.html application/x-www-form-urlencoded On the application / x-www-form-urlencoded explanation of character encoding, etc. Syntax elements in the Form ,EncType That the format used to

  • Content-type 的说明 2013-12-06

    Content-type 的说明 <?php $mimetypes = array( 'ez' => 'application/andrew-inset', 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => 'application/octet-stream', 'dms' =

  • php header Content-Type类型小结 2014-12-22

    php header Content-Type类型小结,很多情况下需要用到Content-Type类型。 <?php $mimetypes = array( 'ez' => 'application/andrew-inset', 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => '

  • struts2 jpg file upload failed Content-Type not allowed solution 2010-08-24

    org.apache.struts2.interceptor.FileUploadInterceptor - Content-Type not allowed: upload "upload__75549ca5_1239ddc5ce6__8000_00000161.tmp" image / pjpeg The original configuration: with ext + struts2 upload progress bar has been shown not di

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.376 (s). 12 q(s)