年月日を表示(イメージ版) | MENU |
Source
<HTML lang="ja"> <HEAD> <TITLE>JavaScript</TITLE> <SCRIPT LANGUAGE="javascript" TYPE="text/javascript"> <!-- wimg=new Array("0.GIF","1.GIF","2.GIF","3.GIF","4.GIF","5.GIF","6.GIF","7.GIF","8.GIF","9.GIF") var date1= new Date(); function disp() { text = (date1.getFullYear() - 2018).toString(); text = (text < 10) ? "0" + text : text; img1 = "<img src='img/" + text.substr(0,1) + ".GIF'>"; img2 = "<img src='img/" + text.substr(1,1) + ".GIF'>"; document.write(img1 + img2); document.write("年".fontsize(5).fontcolor("#0000ff").bold()); text = ((date1.getMonth()+1) < 10) ? "0" + (date1.getMonth()+1).toString() : (date1.getMonth()+1).toString(); img1 = "<img src='img/" + text.substr(0,1) + ".GIF'>"; img2 = "<img src='img/" + text.substr(1,1) + ".GIF'>"; document.write(img1 + img2); document.write("月".fontsize(5).fontcolor("#0000ff").bold()); text = ((date1.getDate()) < 10) ? "0" + (date1.getDate()).toString() : (date1.getDate()).toString(); img1 = "<img src='img/" + text.substr(0,1) + ".GIF'>"; img2 = "<img src='img/" + text.substr(1,1) + ".GIF'>"; document.write(img1 + img2); document.write("日".fontsize(5).fontcolor("#0000ff").bold()); } // --> </SCRIPT> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- disp() //--> </SCRIPT> </BODY> </HTML> |