哪位能帮帮我把这个js代码在页面载入时自动选择2004年和当前月份?

pcbaby 2004-10-08 03:28:57
期号也自动选择第一个期号
http://www.mytaoyuan.com/y.rar

急,不胜感激!
...全文
54 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
pcbaby 2004-10-08
  • 打赏
  • 举报
回复
11540.js文件:
function Dsy() { this.Items = {}; }
Dsy.prototype.add = function(id,iArray) { this.Items[id] = iArray; }
Dsy.prototype.Exists = function(id) { if(typeof(this.Items[id]) == "undefined") return false; return true; };
function change(v){
var str="0";
for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
var ss=document.getElementById(s[v]);
with(ss){
length = 0;
options[0]=new Option(opt0[v],opt0[v]);
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str];
for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]);
if(v)options[1].selected = true;
}
}
if(++v<s.length){change(v);}
}
}
var dsy = new Dsy();


dsy.add("0",["2004"]);
dsy.add("0_0",["9","8","7","6","5","4","3","2"]);
dsy.add("0_0_0",["945","944","943"]);
dsy.add("0_0_1",["942","941","940","939"]);
dsy.add("0_0_2",["938","937","936","935"]);
dsy.add("0_0_3",["933","932","931","930"]);
dsy.add("0_0_4",["929","928","927"]);
dsy.add("0_0_5",["926","925","924","923"]);
dsy.add("0_0_6",["922","921","920","919","918"]);
dsy.add("0_0_7",["917"]);


dsy.add("0_1",["1","2","3","4","5","6","7","8","9","10","11","12"]);
dsy.add("0_1_0",["11","21","31","4","5","6","7","8","9","10","11","12"]);
dsy.add("0_1_1",["1","2","3","4","5","6","7","8","9","10","11","12"]);


1.htm文件:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<script language="JavaScript" src="11540.js"></script>
<SCRIPT LANGUAGE = JavaScript>
<!--
//** Power by Fason(2004-3-11)
//** Email:fason_pfx@hotmail.com

var s=["s1","s2","s3"];
var opt0 = ["年","月","日"];
function setup()
{
for(i=0;i<s.length-1;i++)
document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
change(0);
var y= new Date().getFullYear();
//document.frm.s1.value = y;
//document.frm.s2.value = new Date().getMonth() + 1;
}
//-->
</SCRIPT>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body onload="setup()">
<form name="frm"> <tr>
<td height="25" bgcolor="#ACD1DF" class="9pb" style="padding-top:8px "> <img src="/tea/image/section/11203.gif" width="11" height="8"> 往期回顾</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="padding-left:10;padding-top:10px;"><select id="s1" style="font-size:9pt; "></select>
<select id="s2" style="font-size:9pt; "></select></td>
</tr>
<tr>
<td height="50 valign="top" bgcolor="#FFFFFF" style="padding-left:10;padding-top:10px">第
<select id="s3" style="font-size:9pt; "></select>期 <input TYPE="image" src="/tea/image/section/11205.jpg" name="Submit" value="转到" onclick="goto();" width="41" height="16">
</td>
</tr></form>


</body>
</html>
mrshelly 2004-10-08
  • 打赏
  • 举报
回复
呵呵。RAR文件下不了。
你还不如做个在线的呢。
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-10-08 03:28
社区公告
暂无公告