package Str; import java.util.Calendar; /** * * * @project Tool * @type Test8 * @Description * @author xuyw * @email xyw10000@163.com * @date 2014-8-9 下午01:45:02 * @version 1.0 * */ public class Test8 { /** * @param args */ public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天 int firstDay = calendar.get(Calendar.DAY_OF_WEEK) - 1; int monthDays = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);// 当月最后一天 StringBuilder sbd = new StringBuilder(); sbd.append("<table cellspacing='0' style='background: url(./img/body.png);'>"); sbd.append("<thead><tr>"); sbd .append("<th>星期天</th><th>星期一</th><th>星期二</th><th>星期三</th><th>星期四</th><th>星期五</th><th>星期六</th>"); sbd.append("</tr></thead>"); sbd.append("<tbody><tr>"); // 第一行 int weekend = 0;// 每周的最后一天的日期 for (int i = 0; i < 7; i++) { if (i < firstDay) { sbd.append("<td></td>"); } else { sbd.append("<td>" + (i - firstDay + 1) + "</td>"); } weekend = i - firstDay + 1; } sbd.append("</tr>"); while (weekend < monthDays) { sbd.append("<tr>"); for (int i = 0; i < 7; i++) { if (weekend + i < monthDays)// 数字小于等于当前月的最后一天 { sbd.append("<td>" + (i + weekend + 1) + "</td>"); } else { sbd.append("<td></td>"); } } sbd.append("</tr>"); weekend += 7;// 周末再加7天 } sbd.append("<tbody></table>"); System.out.println(sbd.toString()); } }
先前測試就用控制台產生html標籤 將產生的html標籤在頁面展示即可 效果圖如下
css
* { /* old-style reset here :) */ border: 0px; padding: 0px; } body { font-family: Helvetica; background: white; text-align: center; /* background: url(../img/body.png) repeat-x; */} body h1 { padding-top: 20px; font-size: 36px; color: #335; } p{font-size:26px;} table { border-collapse: separate; border: 1px solid #9DABCE; border-width: 1px 1px 1px 1px; margin: 10px auto; font-size: 30px; } td, th { width: 81px; height: 81px; text-align: center; vertical-align: middle; /*background: url(../img/cells.png);*/ color: #444; position: relative; } th { height: 30px; font-weight: bold; font-size: 14px; } td.sign_in { background-position: 81px 0px; color: red; } td.sign_no{ background: url(../img/cells.png); }
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前By尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前By尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前By尊渡假赌尊渡假赌尊渡假赌
擊敗分裂小說需要多長時間?
3 週前ByDDD
R.E.P.O.保存文件位置:在哪里以及如何保護它?
3 週前ByDDD

熱工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

Atom編輯器mac版下載
最受歡迎的的開源編輯器

Dreamweaver Mac版
視覺化網頁開發工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。