本文實(shí)例講述了jQuery實(shí)現(xiàn)的網(wǎng)格線繪制方法。分享給大家供大家參考,具體如下:
效果圖如下:

代碼如下:
<!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>測(cè)試頁(yè)面</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 = "測(cè)試按鈕" id = "test"/> <div id = "fa"></div> </body></html>更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery表格(table)操作技巧匯總》、《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注