User:Shortway/MyDocuments
外观
这里我的文件夹 --Shortway (Talk) 04:13 2004年3月5日 (UTC)
年份转换程序
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="vbscript">
Function go()
Dim regEx, str1,str2
str1 = InputText.value
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "([^(\[\[)])(\d{4})([^(年\]\])])"
str2 = regEx.Replace(str1, "$1[[$2年]]$3")
OutputText.value=str2
End Function
</script>
<title>New Page 1</title>
</head>
<body>
<textarea rows="7" name="InputText" cols="64" name="InputText">
本程序转换四位数年份为WIKI的条目
例如:1234 转换为 [[1234年]];2004 转换为 [[2004年]]。
您可以修改完善它。
</textarea>
<p><input type="button" name="btn" onclick="vbscript:go()" value="go">
<p><textarea rows="7" name="OutputText" cols="64" name="OutputText"></textarea>
</body>
</html>
还算实用,我用它编辑了物理学家列表。(还需修改,正则不是很懂) --Shortway (Talk) 04:51 2004年3月5日 (UTC)
列表
以下由[[汉语拼音]]排列方法列出[[]]列表。 __NOTOC__ [[#A|A]] [[#B|B]] [[#C|C]] [[#D|D]] [[#E|E]] [[#F|F]] [[#G|G]] [[#H|H]] [[#J|J]] [[#K|K]] [[#L|L]] [[#M|M]] [[#N|N]] [[#O|O]] [[#P|P]] [[#Q|Q]] [[#R|R]] [[#S|S]] [[#T|T]] [[#W|W]] [[#X|X]] [[#Y|Y]] [[#Z|Z]] ==A== ==B== ==C== ==D== ==E== ==F== ==G== ==H== ==J== ==K== ==L== ==M== ==N== ==O== ==P== ==Q== ==R== ==S== ==T== ==W== ==X== ==Y== ==Z==
--Shortway (Talk) 09:26 2004年3月5日 (UTC)
每天条目自动生成
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function MM_findObj(n, d)
{ //v4.01
var p,i,x;
if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all) x=d.all[n];
for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n);
return x;
}
function JM_cc(name)
{
var obj=MM_findObj(name); if (obj)
{
obj.select();
js=obj.createTextRange();
js.execCommand("Copy");
}
}
var theMonths = new Array(12)
{//月份数组
theMonths[0] = "January";
theMonths[1] = "February";
theMonths[2] = "March";
theMonths[3] = "April";
theMonths[4] = "May";
theMonths[5] = "June";
theMonths[6] = "July";
theMonths[7] = "August";
theMonths[8] = "September";
theMonths[9] = "October";
theMonths[10] = "November";
theMonths[11] = "December";
}
var toDay = new Date(); // 获取今天的日期。
var currentYear = toDay.getYear();
var thisMonth = toDay.getMonth() + 1;
var thisDay = toDay.getDate();
// 提取当前年、月、日信息。
var thisDate = theMonths[thisMonth-1] + " " + thisDay + ",2004";
// 确定从 1970 年 1 月 1 日 00:00:00.000 开始以来的天数
thisDate = parseInt(Date.parse(thisDate)/8.64e7);
// 提取元旦信息。
var firstDate = parseInt(Date.parse("Jan 1,2004")/8.64e7);
// 提取年底信息。
var lastDate = parseInt(Date.parse("Dec 31,2004")/8.64e7);
function change_it()
{
var select_item_m=frmDIH.txtMonth.options[frmDIH.txtMonth.selectedIndex].text;
switch(select_item_m)
{
case '2' : MD(29);break;
case '4' :
case '6' :
case '9' :
case '11' : MD(30);break;
default : MD(31);break;
}
}
function MD(days)
{
var j=frmDIH.txtDay.options.length;
var k,i;
for(k=0;k<j;k++) frmDIH.txtDay.options.remove(0);
for(i=0;i<days;i++)
{
var day=document.createElement("OPTION");
frmDIH.txtDay.options.add(day);
day.innerText=i+1;
frmDIH.txtDay.selectedIndex=thisDay-1;
}
}
function go()
{
// 月、日信息。
thisMonth = parseInt(frmDIH.txtMonth.options[frmDIH.txtMonth.selectedIndex].text);
thisDay = parseInt(frmDIH.txtDay.options[frmDIH.txtDay.selectedIndex].text);
var thisDate = theMonths[thisMonth-1] + " " + thisDay + ",2004";
// 确定从 1970 年 1 月 1 日 00:00:00.000 开始以来的天数
thisDate = parseInt(Date.parse(thisDate)/8.64e7);
// 提取3月1日信息。
var March_1 = parseInt(Date.parse("Mar 1,2004")/8.64e7);
//判断是否已过3月1日
var March_1_Left = (thisDate >= March_1);
//第几天
var daysElapsed = thisDate - firstDate + 1;
//还剩下多少天
var daysLeft = lastDate - thisDate;
var strDIH="";
strDIH=strDIH + "\'\'\'" + thisMonth + "月" + thisDay + "日\'\'\'是\[\[公历\]\]一年中的第";
if (!March_1_Left)
{
strDIH=strDIH + daysElapsed + "天,离全年的结束还有" + (daysLeft-1) + "天(\[\[闰年\]\]是" + daysLeft + "天)。";
}
else
{
strDIH=strDIH + (daysElapsed-1) + "天(\[\[闰年\]\]第" + daysElapsed + "天),离全年的结束还有" + daysLeft + "天。";
}
strDIH=strDIH + "\n";
strDIH=strDIH + "{{msg:"+ theMonths[thisMonth-1] +"Calendar}}\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\=\=大事记\=\=\n";
strDIH=strDIH + "\*\[\[年\]\]——。\n";
strDIH=strDIH + "\*\[\[年\]\]——。\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\=\=出生\=\=\n";
strDIH=strDIH + "\*\[\[年\]\]——。\n";
strDIH=strDIH + "\*\[\[年\]\]——。\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\=\=逝世\=\=\n";
strDIH=strDIH + "\*\[\[年\]\]——。\n";
strDIH=strDIH + "\*\[\[年\]\]——。\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\=\=节日、风俗习惯\=\=\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\-\-\-\-\n";
strDIH=strDIH + "\=\=参看\=\=\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\[\[历史上的今天|日历\]\]\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\[\[" + thisMonth + "月" + (thisDay-2) + "日\]\] \-\- \[\[" + thisMonth + "月" + (thisDay-1) + "日\]\] \-\- \'\'\'" + thisMonth + "月" + thisDay + "日\'\'\' \-\- \[\[" + thisMonth + "月" + (thisDay+1) + "日\]\] \-\- \[\[" + thisMonth + "月" + (thisDay+2) + "日\]\]\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\[\[" + (thisMonth-1) + "月" + thisDay + "日\]\] \-\- \'\'\'" + thisMonth + "月" + thisDay + "日\'\'\' \-\- \[\[" + (thisMonth+1) + "月" + thisDay + "日\]\]\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\[\[1月\]\] \-\- \[\[2月\]\] \-\- \[\[3月\]\] \-\- \[\[4月\]\] \-\- \[\[5月\]\] \-\- \[\[6月\]\] \-\- \[\[7月\]\] \-\- \[\[8月\]\] \-\- \[\[9月\]\] \-\- \[\[10月\]\] \-\- \[\[11月\]\] \-\- \[\[12月\]\]\n";
strDIH=strDIH + "\n";
strDIH=strDIH + "\[\[en\:" + theMonths[thisMonth-1] + "\ " + thisDay + "\]\]\n";
strDIH=strDIH + "\[\[ja\:" + thisMonth + "\&\#26376\;" + thisDay + "\&\#26085\;\]\]\n";
frmDIH.OutputText.value=strDIH;
}
</script>
<title>每天条目自动生成</title>
</head>
<body onload="javascript:change_it()">
<p align="center">本程序自动生成[[*月*日]]条目。您可以修改完善它。——Writed by Shortway
<form name="frmDIH">
<p align="center">
<select size="1" name="txtMonth" onChange=change_it()>
<script language="javascript">
for (i=1;i<=12;i++)
{
document.write("<option value=" + i);
if (thisMonth == i)document.write(" selected");
document.write(">" + i + "</option>");
}
</script>
</select>月
<select size="1" name="txtDay">
<script language="javascript">
for (i=1;i<=31;i++)
{
document.write("<option value=" + i);
if (thisDay == i)document.write(" selected");
document.write(">" + i + "</option>");
}
</script>
</select>日
<input type="button" name="btn" onclick="javascript:go()" value=" GO ">
<INPUT onclick="javascript:JM_cc('OutputText')" type=button value="复制到剪贴板" name="Button2">
<p align="center"><textarea rows="35" name="OutputText" cols="100" name="OutputText"></textarea>
</form>
</body>
</html>
--Shortway (Talk) 07:49 2004年3月10日 (UTC)