内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

java小程序日歷源代碼 java設(shè)計日歷小程序

關(guān)于Java的一個小程序,懂得來幫個忙

這是我編過的程序

十載的德令哈網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。營銷型網(wǎng)站的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整德令哈建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。成都創(chuàng)新互聯(lián)從事“德令哈網(wǎng)站設(shè)計”,“德令哈網(wǎng)站推廣”以來,每個客戶項目都認真落實執(zhí)行。

它用來計算兩個日期之間間隔

某日期向前/后幾天是什么日期(考慮閏年)

星期幾不好算,肯定要找個基準點

import java.awt.*;

import java.awt.event.*;

public class dakiler

{

public static void main(String args[])

{

new mainpage();

}

}

class mainpage extends Frame implements ActionListener

{

private Button button2,button3,button4;

forward frame1;

backward frame2;

twodates frame3;

mainpage()

{

super("主選擇頁面");

this.setLayout(new FlowLayout());

this.setLocation(250,250);

button2=new Button("日期向后計算");

button3=new Button("日期向前計算");

button4=new Button("兩個日期計算");

button2.addActionListener(this);

button3.addActionListener(this);

button4.addActionListener(this);

this.add(button2);

this.add(button3);

this.add(button4);

this.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

}

);

this.pack();

this.show();

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==button2)

{

this.setLocation(0,0);

forward frame1=new forward();

}

if(e.getSource()==button3)

{

this.setLocation(0,0);

backward frame2=new backward();

}

if(e.getSource()==button4)

{

this.setLocation(0,0);

twodates frame3=new twodates();

}

this.pack();

}

}

*/

class mainpage extends Frame implements ItemListener

{

private Choice choice;

private Label label1;

forward frame1;

backward frame2;

twodates frame3;

mainpage () {

this.setLayout(null);

this.setBounds(250,250,150,90);

choice=new Choice();

label1=new Label("請選擇");

choice.addItem("日期向后計算");

choice.addItem("日期向前計算");

choice.addItem("兩個日期計算");

choice.addItemListener(this);

label1.setBounds(20,30,100,20);

choice.setBounds(20,50,100,20);

this.add(label1);

this.add(choice);

this.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

}

);

this.show();

}

public void itemStateChanged(ItemEvent e)

{

if(choice.getSelectedItem().equals("日期向后計算"))

{

this.setLocation(0,0);

if (frame1!=null) frame1.dispose();

if (frame2!=null) frame2.dispose();

if (frame3!=null) frame3.dispose();

frame1=new forward();

}

if(choice.getSelectedItem().equals("日期向前計算"))

{

this.setLocation(0,0);

if (frame1!=null) frame1.dispose();

if (frame2!=null) frame2.dispose();

if (frame3!=null) frame3.dispose();

frame2=new backward();

}

if(choice.getSelectedItem().equals("兩個日期計算"))

{

this.setLocation(0,0);

if (frame1!=null) frame1.dispose();

if (frame2!=null) frame2.dispose();

if (frame3!=null) frame3.dispose();

frame3=new twodates();

}

}

}

class forward extends Frame implements ActionListener

{

private Button button5,button6;

private TextField yeartextfield,monthtextfield,daytextfield,timetextfield,answertextfield;

private Label yearlabel,monthlabel,daylabel,timelabel,answerlabel;

private double year,month,day,time;

private boolean isren,iscontinue;

forward()

{

super("日期向后計算");

this.setLayout(null);

this.setBounds(0,250,800,150);

this.setResizable(false);

button5=new Button("確定");

button6=new Button("清除");

yearlabel=new Label("請輸入年份");

monthlabel=new Label("請輸入月份");

daylabel=new Label("請輸入日期");

timelabel=new Label("請輸入向后幾天");

answerlabel=new Label("答案是");

yeartextfield=new TextField(5);

monthtextfield=new TextField(5);

daytextfield=new TextField(5);

timetextfield=new TextField(5);

answertextfield=new TextField(20);

button5.addActionListener(this);

button6.addActionListener(this);

yeartextfield.addActionListener(this);

monthtextfield.addActionListener(this);

daytextfield.addActionListener(this);

timetextfield.addActionListener(this);

yearlabel.setBounds(0,50,100,20);

yeartextfield.setBounds(100,50,100,20);

monthlabel.setBounds(0,80,100,20);

monthtextfield.setBounds(100,80,100,20);

daylabel.setBounds(0,110,100,20);

daytextfield.setBounds(100,110,100,20);

timelabel.setBounds(200,80,100,20);

timetextfield.setBounds(300,80,100,20);

button5.setBounds(400,80,100,20);

button6.setBounds(500,80,100,20);

answerlabel.setBounds(600,80,100,20);

answertextfield.setBounds(700,80,100,20);

this.add(yearlabel);

this.add(yeartextfield);

this.add(monthlabel);

this.add(monthtextfield);

this.add(daylabel);

this.add(daytextfield);

this.add(timelabel);

this.add(timetextfield);

this.add(button5);

this.add(button6);

this.add(answerlabel);

this.add(answertextfield);

this.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

dispose();

}

}

);

this.show();

}

public void actionPerformed(ActionEvent e)

{

if (e.getSource()==button6)

{

yeartextfield.setText("");

monthtextfield.setText("");

daytextfield.setText("");

timetextfield.setText("");

answertextfield.setText("");

}

else if((e.getSource()==button5)||(e.getSource()==yeartextfield)||(e.getSource()==monthtextfield)||(e.getSource()==daytextfield)||(e.getSource()==timetextfield))

{

try

{

year=Double.parseDouble(yeartextfield.getText());

month=Double.parseDouble(monthtextfield.getText());

day=Double.parseDouble(daytextfield.getText());

time=Double.parseDouble(timetextfield.getText());

}

catch (Exception exc)

{

iscontinue=false;

answertextfield.setText("輸入不正確");

}

function func=new function();

isren=func.ren(year);

iscontinue=false;

iscontinue=func.conti(month,day,isren);

if(iscontinue)

{

String str=func.plus(year,month,day,time);

answertextfield.setText(str);

}

else

{ answertextfield.setText("輸入不正確");

}

}

}

}

class backward extends Frame implements ActionListener

{

private Button button5,button6;

private TextField yeartextfield,monthtextfield,daytextfield,timetextfield,answertextfield;

private Label yearlabel,monthlabel,daylabel,timelabel,answerlabel;

private double year,month,day,time;

private boolean isren,iscontinue;

backward()

{

super("日期向前計算");

this.setLayout(null);

this.setBounds(0,250,800,150);

this.setResizable(false);

button5=new Button("確定");

button6=new Button("清除");

yearlabel=new Label("請輸入年份");

monthlabel=new Label("請輸入月份");

daylabel=new Label("請輸入日期");

timelabel=new Label("請輸入向前幾天");

answerlabel=new Label("答案是");

yeartextfield=new TextField(5);

monthtextfield=new TextField(5);

daytextfield=new TextField(5);

timetextfield=new TextField(5);

answertextfield=new TextField(20);

button5.addActionListener(this);

button6.addActionListener(this);

yeartextfield.addActionListener(this);

monthtextfield.addActionListener(this);

daytextfield.addActionListener(this);

timetextfield.addActionListener(this);

yearlabel.setBounds(0,50,100,20);

yeartextfield.setBounds(100,50,100,20);

monthlabel.setBounds(0,80,100,20);

monthtextfield.setBounds(100,80,100,20);

daylabel.setBounds(0,110,100,20);

daytextfield.setBounds(100,110,100,20);

timelabel.setBounds(200,80,100,20);

timetextfield.setBounds(300,80,100,20);

button5.setBounds(400,80,100,20);

button6.setBounds(500,80,100,20);

answerlabel.setBounds(600,80,100,20);

answertextfield.setBounds(700,80,100,20);

this.add(yearlabel);

this.add(yeartextfield);

this.add(monthlabel);

this.add(monthtextfield);

this.add(daylabel);

this.add(daytextfield);

this.add(timelabel);

this.add(timetextfield);

this.add(button5);

this.add(button6);

this.add(answerlabel);

this.add(answertextfield);

this.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

dispose();

}

}

);

this.show();

}

public void actionPerformed(ActionEvent e)

{

if (e.getSource()==button6)

{

yeartextfield.setText("");

monthtextfield.setText("");

daytextfield.setText("");

timetextfield.setText("");

answertextfield.setText("");

}

else if((e.getSource()==button5)||(e.getSource()==yeartextfield)||(e.getSource()==monthtextfield)||(e.getSource()==daytextfield)||(e.getSource()==timetextfield))

{

try

{

year=Double.parseDouble(yeartextfield.getText());

month=Double.parseDouble(monthtextfield.getText());

day=Double.parseDouble(daytextfield.getText());

time=Double.parseDouble(timetextfield.getText());

}

catch (Exception exc)

{

iscontinue=false;

answertextfield.setText("輸入不正確");

}

function func=new function();

isren=func.ren(year);

iscontinue=false;

iscontinue=func.conti(month,day,isren);

if(iscontinue)

{

String str=func.minus(year,month,day,time);

answertextfield.setText(str);

}

else

{ answertextfield.setText("輸入不正確");

}

}

}

}

class twodates extends Frame implements ActionListener

{

private Button button5,button6;

private TextField yeartextfield1,monthtextfield1,daytextfield1,answertextfield,yeartextfield2,monthtextfield2,daytextfield2;

private Label yearlabel1,monthlabel1,daylabel1,yearlabel2,monthlabel2,daylabel2,answerlabel;

private double year1,month1,day1,year2,month2,day2;

private boolean isren1,isren2,iscontinue;

private int days;

public twodates()

{

super("兩個日期計算");

this.setLayout(null);

this.setBounds(0,250,100,800);

this.setSize(800,150);

this.setResizable(false);

button5=new Button("確定");

button6=new Button("清除");

yearlabel1=new Label("請輸入第一個年份");

monthlabel1=new Label("請輸入第一個月份");

daylabel1=new Label("請輸入第一個日期");

yearlabel2=new Label("請輸入第二個年份");

monthlabel2=new Label("請輸入第二個月份");

daylabel2=new Label("請輸入第二個日期");

answerlabel=new Label("答案是");

yeartextfield1=new TextField(5);

monthtextfield1=new TextField(5);

daytextfield1=new TextField(5);

yeartextfield2=new TextField(5);

monthtextfield2=new TextField(5);

daytextfield2=new TextField(5);

answertextfield=new TextField(20);

button5.addActionListener(this);

button6.addActionListener(this);

yeartextfield1.addActionListener(this);

monthtextfield1.addActionListener(this);

daytextfield1.addActionListener(this);

yeartextfield2.addActionListener(this);

monthtextfield2.addActionListener(this);

daytextfield2.addActionListener(this);

yearlabel1.setBounds(0,50,100,20);

yeartextfield1.setBounds(100,50,100,20);

monthlabel1.setBounds(0,80,100,20);

monthtextfield1.setBounds(100,80,100,20);

daylabel1.setBounds(0,110,100,20);

daytextfield1.setBounds(100,110,100,20);

yearlabel2.setBounds(200,50,100,20);

yeartextfield2.setBounds(300,50,100,20);

monthlabel2.setBounds(200,80,100,20);

monthtextfield2.setBounds(300,80,100,20);

daylabel2.setBounds(200,110,100,20);

daytextfield2.setBounds(300,110,100,20);

button5.setBounds(400,80,100,20);

button6.setBounds(500,80,100,20);

answerlabel.setBounds(600,80,100,20);

answertextfield.setBounds(700,80,100,20);

this.add(yearlabel1);

this.add(yeartextfield1);

this.add(monthlabel1);

this.add(monthtextfield1);

this.add(daylabel1);

this.add(daytextfield1);

this.add(yearlabel2);

this.add(yeartextfield2);

this.add(monthlabel2);

this.add(monthtextfield2);

this.add(daylabel2);

this.add(daytextfield2);

this.add(button5);

this.add(button6);

this.add(answerlabel);

this.add(answertextfield);

this.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

dispose();

}

}

);

this.show();

}

public void actionPerformed(ActionEvent e)

{

if (e.getSource()==button6)

{

this.setSize(800,150);

yeartextfield1.setText("");

monthtextfield1.setText("");

daytextfield1.setText("");

yeartextfield2.setText("");

monthtextfield2.setText("");

daytextfield2.setText("");

answertextfield.setText("");

}

else if((e.getSource()==button5)||(e.getSource()==yeartextfield1)||(e.getSource()==monthtextfield1)||(e.getSource()==daytextfield1)||(e.getSource()==yeartextfield2)||(e.getSource()==monthtextfield2)||(e.getSource()==daytextfield2))

{

this.setSize(800,150);

try

{

year1=Double.parseDouble(yeartextfield1.getText());

month1=Double.parseDouble(monthtextfield1.getText());

day1=Double.parseDouble(daytextfield1.getText());

year2=Double.parseDouble(yeartextfield2.getText());

month2=Double.parseDouble(monthtextfield2.getText());

day2=Double.parseDouble(daytextfield2.getText());

}

catch (Exception exc)

{

iscontinue=false;

answertextfield.setText("輸入不正確");

}

function func=new function();

isren1=func.ren(year1);

isren2=func.ren(year2);

iscontinue=false;

iscontinue=(func.conti(month1,day1,isren1))(func.conti(month2,day2,isren2));

if(iscontinue)

{

days=func.between(year1,month1,day1,year2,month2,day2);

answertextfield.setText("差"+days+"天");

}

else

{ answertextfield.setText("輸入不正確");

}

}

}

}

class function

{

private String str;

private int year1,month1,day1,time1;

private int days=0;

private double temp;

public boolean ren(double year)

{

if(((year%4==0)(year%100!=0))||(year%400==0))

return true;

else return false;

}

public boolean conti(double month,double day,boolean isren)

{

boolean boo=true;

if((month=0)||(month12))

{ boo=false;}

else

{

switch ((int)month)

{

case 1:

case 3:

case 5:

case 7:

case 8:

case 10:

case 12: if ((day31)||(day=0)) boo=false;

else boo=true;

break;

case 4:

case 6:

case 9:

case 11: if ((day30)||(day=0)) boo=false;

else boo=true;

break;

case 2: if (isren)

{

if ((day29)||(day=0)) boo=false;

else boo=true;

}

else

{

if ((day28)||(day=0)) boo=false;

else boo=true;

}

break;

}

}

return boo;

}

public String plus(double year,double month,double day,double time)

{

year1=(int)year;

month1=(int)month;

day1=(int)day;

time1=(int)time;

for (int i=1;i=time1;i++)

{

if ((month1==12)(day1==31))

{

year1++;

month1=1;

day1=1;

}

else if (((month1==1)||(month1==3)||(month1==5)||(month1==7)||(month1==8)||(month1==10))(day1==31))

{

month1++;

day1=1;

}

else if(((month1==4)||(month1==6)||(month1==9)||(month1==11))(day1==30))

{

求Java 日歷的小程序的源代碼

也不知道你具體需求是什么,以前改過一個日歷程序,一共四個java類,放在同一個包里。經(jīng)測試可以運行。

//Start.java

import java.awt.*;

import javax.swing.*;

class Start{

public static void main(String [] args){

DateFrame frame=new DateFrame();

frame.setLocationRelativeTo(frame);

frame.setResizable(false);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

}

}

//DateInfo.java

import java.util.*;

public class DateInfo{

private int mYear, mMonth;

private int mDayOfMonth, mFristWeek;

public DateInfo(int year, int month) throws DateException{

mYear = year;

if (month 0 || month 12){

throw (new DateException());

}

mMonth = month;

mDayOfMonth = getDayOfMonth(mYear, mMonth);

mFristWeek = getFristWeek(mYear, mMonth);

}

private int getDayOfMonth(int year, int month){

int[][] ary = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},

{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};

return (ary[isLeapYear(year)][month]);

}

private int isLeapYear(int year){

if (year % 4 == 0 year % 100 != 0 ||year % 400 == 0){

return (1);

}

else{

return (0);

}

}

private int getFristWeek(int year, int month){

java.util.Calendar cal = Calendar.getInstance();

cal.set(year, month - 1, 1);

return (cal.get(Calendar.DAY_OF_WEEK) - 1);

}

public String toString(){

String str;

str = "\t\t" + mYear + "年" + mMonth + "月\n";

str += "日\t一\t二\t三\t四\t五\t六\n";

int i;

for (i = 1; i = mFristWeek; i++){

str += " \t";

}

for (int j = 1; j = mDayOfMonth; j++, i++){

str +=j+"\t" ;

if (i % 7 == 0){

str += "\n";

}

}

return (str);

}

}

//DateFrame.java

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.Calendar;

class DateFrame extends JFrame implements Runnable{

Calendar date=Calendar.getInstance();

String[] str={"1","2","3","4","5","6","7","8","9","10","11","12"};

JLabel lblYear=new JLabel("年 ");

JLabel lblMonth=new JLabel("月 ");

JLabel lblDate=new JLabel("現(xiàn)在的時間是:");

JLabel lblShowDate=new JLabel();

// javax.swing.JTextField trxt =new JTextField(10);

// trxt.setHorizontalAlignment(JTextField.RIGHT); //設(shè)置文本從右邊輸入

JComboBox cboMonth=new JComboBox(str);

JComboBox cboYear=new JComboBox();

JTextArea txaShow=new JTextArea();

JPanel pnlNorth=new JPanel();

JPanel pnlSOUTH=new JPanel();

JButton btnShow=new JButton("顯示");

JButton btnClose=new JButton("關(guān)閉");

JScrollPane jsp=new JScrollPane(txaShow);

Container c=this.getContentPane();

public DateFrame(){

Thread thread=new Thread(this);

thread.start();

this.setTitle("玩玩日歷拉!!!");

this.setSize(300,260);

for (int i = 1990; i=2025; i++) {

cboYear.addItem(""+i);

}

cboYear.setSelectedItem(""+(date.get(Calendar.YEAR)));

cboMonth.setSelectedItem(""+(date.get(Calendar.MONTH)+1));

pnlNorth.add(cboYear);

txaShow.setTabSize(4); //設(shè)置tab鍵的距離

txaShow.setForeground(Color.GREEN);

pnlNorth.add(lblYear);

pnlNorth.add(cboMonth);

pnlNorth.add(lblMonth);

pnlNorth.add(lblDate);

pnlNorth.add(lblShowDate);

c.add(pnlNorth,BorderLayout.NORTH);

c.add(jsp);

pnlSOUTH.add(btnShow);

pnlSOUTH.add(btnClose);

c.add(pnlSOUTH,BorderLayout.SOUTH);

btnShow.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

int year=Integer.parseInt((String)cboYear.getSelectedItem());

int month=Integer.parseInt((String)cboMonth.getSelectedItem());

try {

DateInfo date=new DateInfo(year,month);

txaShow.setText(""+date);

}

catch (DateException ex) {

ex.printStackTrace();

}

}

});

btnClose.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

System.exit(0);

}

});

}

public void run(){

try {

while(true){

Thread.sleep(1000);

int hour=date.get(Calendar.HOUR);

int minute=date.get(Calendar.MINUTE);

int second=date.get(Calendar.SECOND);

String str=hour+":"+minute+":"+second;

lblShowDate.setText(str);

//this.repaint();

}

}

catch (Exception ex) {

ex.printStackTrace();

}

}

}

//DateException.java

public class DateException extends Exception{

public DateException(){

super("日期數(shù)據(jù)不合法.");

}

}

求Java萬年歷源代碼!!!

我有個JS的要么?

你可以把他改下我是沒時間幫你該哈!?。?/p>

!--日期框選擇--

var DS_x,DS_y;

function dateSelector() //構(gòu)造dateSelector對象,用來實現(xiàn)一個日歷形式的日期輸入框。

{

var myDate=new Date();

this.year=myDate.getFullYear(); //定義year屬性,年份,默認值為當前系統(tǒng)年份。

this.month=myDate.getMonth()+1; //定義month屬性,月份,默認值為當前系統(tǒng)月份。

this.date=myDate.getDate(); //定義date屬性,日,默認值為當前系統(tǒng)的日。

this.inputName=''; //定義inputName屬性,即輸入框的name,默認值為空。注意:在同一頁中出現(xiàn)多個日期輸入框,不能有重復(fù)的name!

this.display=display; //定義display方法,用來顯示日期輸入框。

}

function display() //定義dateSelector的display方法,它將實現(xiàn)一個日歷形式的日期選擇框。

{

var week=new Array('日','一','二','三','四','五','六');

document.write("style type=text/css");

document.write(" .ds_font td,span { font: normal 12px 宋體; color: #000000; }");

document.write(" .ds_border { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");

document.write(" .ds_border2 { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");

document.write("/style");

var M=new String(this.month);

var d=new String(this.date);

if(M.length==1d.length==1){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-0"+this.month+"-0"+this.date+"' title=雙擊可進行編緝 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

else if(M.length==1d.length==2){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-0"+this.month+"-"+this.date+"' title=雙擊可進行編緝 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

else if(M.length==2d.length==1){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-0"+this.date+"' title=雙擊可進行編緝 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

else if(M.length==2d.length==2){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-"+this.date+"' title=雙擊可進行編緝 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

document.write("button style='width:60px;height:18px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#DFE7EF;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()日期/button");

document.write("div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'");

document.write(" div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D;' class=ds_font");

document.write(" table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'");

document.write(" tr align=center");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='減小年份'/td");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subMonth(this) title='減小月份'/td");

document.write(" td width=52%b"+this.year+"/bb年/bb"+this.month+"/bb月/b/td");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addMonth(this) title='增加月份'/td");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addYear(this) title='增加年份'/td");

document.write(" /tr");

document.write(" /table");

document.write(" table cellpadding=0 cellspacing=0 width=140 height=20 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'");

document.write(" tr align=center");

for(i=0;i7;i++)

document.write(" td"+week[i]+"/td");

document.write(" /tr");

document.write(" /table");

document.write(" table cellpadding=0 cellspacing=2 width=140 bgcolor=#EEEEEE");

for(i=0;i6;i++)

{

document.write(" tr align=center");

for(j=0;j7;j++)

document.write(" td width=10% height=16 onmouseover=if(this.innerText!=''this.className!='ds_border2')this.className='ds_border' onmouseout=if(this.className!='ds_border2')this.className='' onclick=getValue(this,document.all('DS_"+this.inputName+"'))/td");

document.write(" /tr");

}

document.write(" /table");

document.write(" span style=cursor:hand onclick=this.parentNode.parentNode.style.display='none'【關(guān)閉】/span");

document.write(" /div");

document.write("/div");

dateShow(document.all("DS_"+this.inputName).nextSibling.nextSibling.childNodes[0].childNodes[2],this.year,this.month)

}

function subYear(obj) //減小年份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

myObj[0].innerHTML=eval(myObj[0].innerHTML)-1;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function addYear(obj) //增加年份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

myObj[0].innerHTML=eval(myObj[0].innerHTML)+1;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function subMonth(obj) //減小月份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

var month=eval(myObj[2].innerHTML)-1;

if(month==0)

{

month=12;

subYear(obj);

}

myObj[2].innerHTML=month;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function addMonth(obj) //增加月份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

var month=eval(myObj[2].innerHTML)+1;

if(month==13)

{

month=1;

addYear(obj);

}

myObj[2].innerHTML=month;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function dateShow(obj,year,month) //顯示各月份的日

{

var myDate=new Date(year,month-1,1);

var today=new Date();

var day=myDate.getDay();

var selectDate=obj.parentNode.parentNode.previousSibling.previousSibling.value.split('-');

var length;

switch(month)

{

case 1:

case 3:

case 5:

case 7:

case 8:

case 10:

case 12:

length=31;

break;

case 4:

case 6:

case 9:

case 11:

length=30;

break;

case 2:

if((year%4==0)(year%100!=0)||(year%400==0))

length=29;

else

length=28;

}

for(i=0;iobj.cells.length;i++)

{

obj.cells[i].innerHTML='';

obj.cells[i].style.color='';

obj.cells[i].className='';

}

for(i=0;ilength;i++)

{

obj.cells[i+day].innerHTML=(i+1);

if(year==today.getFullYear()(month-1)==today.getMonth()(i+1)==today.getDate())

obj.cells[i+day].style.color='red';

if(year==eval(selectDate[0])month==eval(selectDate[1])(i+1)==eval(selectDate[2]))

obj.cells[i+day].className='ds_border2';

}

}

function getValue(obj,inputObj) //把選擇的日期傳給輸入框

{

var myObj=inputObj.nextSibling.nextSibling.childNodes[0].childNodes[0].cells[2].childNodes;

if(obj.innerHTML)

if(obj.innerHTML.length==1myObj[2].innerHTML.length==1)

inputObj.value=myObj[0].innerHTML+"-0"+myObj[2].innerHTML+"-0"+obj.innerHTML;

else if(obj.innerHTML.length==1myObj[2].innerHTML.length==2)

inputObj.value=myObj[0].innerHTML+"-"+myObj[2].innerHTML+"-0"+obj.innerHTML;

else if(obj.innerHTML.length==2myObj[2].innerHTML.length==1)

inputObj.value=myObj[0].innerHTML+"-0"+myObj[2].innerHTML+"-"+obj.innerHTML;

else if(obj.innerHTML.length==2myObj[2].innerHTML.length==2)

inputObj.value=myObj[0].innerHTML+"-"+myObj[2].innerHTML+"-"+obj.innerHTML;

inputObj.nextSibling.nextSibling.style.display='none';

for(i=0;iobj.parentNode.parentNode.parentNode.cells.length;i++)

obj.parentNode.parentNode.parentNode.cells[i].className='';

obj.className='ds_border2'

}

function dsMove(obj) //實現(xiàn)層的拖移

{

if(event.button==1)

{

var X=obj.clientLeft;

var Y=obj.clientTop;

obj.style.pixelLeft=X+(event.x-DS_x);

obj.style.pixelTop=Y+(event.y-DS_y);

}

}

/***調(diào)用代碼**

script language=javascript

var myDate=new dateSelector();

myDate.year=1900;//morenqiri

myDate.inputName='date'; //

myDate.display();

/script

*/

文章名稱:java小程序日歷源代碼 java設(shè)計日歷小程序
文章出自:http://m.rwnh.cn/article26/doopsjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、網(wǎng)頁設(shè)計公司、軟件開發(fā)電子商務(wù)、網(wǎng)站設(shè)計、微信公眾號

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計
和平区| 本溪市| 贺州市| 电白县| 湘西| 牟定县| 黎平县| 城市| 九龙县| 咸丰县| 永登县| 宜宾市| 盐津县| 蒙山县| 枣阳市| 确山县| 信宜市| 象山县| 都匀市| 衡阳县| 二手房| 蒙阴县| 札达县| 柯坪县| 宜君县| 贡山| 汽车| 兰州市| 江孜县| 二手房| 伊通| 呼伦贝尔市| 隆安县| 绍兴县| 濮阳县| 玛纳斯县| 东乡县| 河池市| 廊坊市| 巨鹿县| 宁陵县|