我想帮忙。我想从下拉列表中更改为编码此格式,我不知道如何。
<option value="a">28th March 2010</option>
<option value="b">28 March 2010</option>
<option value="c">28th Mar 2010</option>
<option value="d">28 Mar 2010</option>
<option value="e">28/03/2010</option>
<option value="f">28th March 10</option>
<option value="g">28 March 10</option>
<option value="h">28th Mar 10</option>
<option value="i">28 Mar 10</option>
<option value="j">28/03/10</option>
<option value="k">28th March</option>
<option value="l">28 March</option>
<option value="m">28th Mar</option>
<option value="o">28 Mar</option>
<option value="p">28/03</option>
<select name="day">
<option value="f">Sunday</option>
<option value="s">Sun</option>
</select>
<select name="time">
<option value="a">5:28:12 am</option>
<option value="b">5:28 am</option>
<option value="c">5:28:12</option>
<option value="d">17:28:12</option>
<option value="e">17:28</option>
<option value="f">5:28</option>
</select>
到此代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<script type="text/JavaScript">
var wd=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var D=[
['Bucharest',120],
['Madrid',60],
['New York',-300],
['Nairobi',180],
['London',0],
['Buenes Aires',-180]
]
function calc(){
var spans=document.getElementById('zonediv').getElementsByTagName('span')
for(var i=0;i<D.length;i++){
var t=new Date();
t.setTime(t.getTime()+(t.getTimezoneOffset()*60000)+((D[i][1])*60000));//the zone's time
var Dy=t.getFullYear();
var Dd=t.getDate()<10?'0'+t.getDate():t.getDate();
var Dm=t.getMonth()<10?'0'+(t.getMonth()+1):t.getMonth()+1;
var Dh=t.getHours()<10?'0'+t.getHours():t.getHours();
var Di=t.getMinutes()<10?'0'+t.getMinutes():t.getMinutes();
var Ds=t.getSeconds()<10?'0'+t.getSeconds():t.getSeconds();
var Dz=wd[t.getDay()];
spans[i].firstChild.data=Dh+':'+Di+':'+Ds+' - '+Dz+' '+Dd+'/'+Dm+'/'+Dy;
}
setTimeout('calc()',1000)
}
onload=function(){
var root = document.getElementById('zonediv');
for(var i=0;i<D.length;i++){
root.appendChild(document.createTextNode(D[i][0]+' '))
var sp= document.createElement('span');
sp.appendChild(document.createTextNode(' '));
root.appendChild(sp);root.appendChild(document.createElement('br'))
}
calc();
}
</script>
</head>
<body>
<div id="zonediv">
</div>
</body>
</html>