Posted in Javascript onJune 20, 2016
本文实例讲述了jQuery实现的网格线绘制方法。分享给大家供大家参考,具体如下:
效果图如下:
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>测试页面</title> <script type ="text/javascript" src='jquery-1.7.2.js'></script> <style type = "text/css"> body{ background:#000000; } #fa{ width:380px; height:380px; margin:100px auto; background:#4b4b4b; } </style> <script type = "text/javascript"> $(function(){ var table = document.createElement("table"); var tbody = document.createElement("tbody"); table.style.borderCollapse = "collapse"; for(var i = 0;i<20;i++){ var tr = document.createElement("tr"); for(var j = 0;j<20;j++){ var td = document.createElement("td"); var text = document.createTextNode(""); td.style.border = "1px solid #dfdfdf"; td.style.padding = "9px"; td.appendChild(text); tr.appendChild(td); } table.appendChild(tr); } document.getElementById("fa").appendChild(table); }) </script> </head> <body> <input type = "button" value = "测试按钮" id = "test"/> <div id = "fa"></div> </body> </html>
希望本文所述对大家jQuery程序设计有所帮助。
jQuery实现的网格线绘制方法
- Author -
cherry声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@