为什么文本域不能设为只读模式
大家好,我正在学习网页制作,想把表格第一行的日期都变成只读模式,不能改动,试了很多方法都不行,还请各位高手指点,谢谢。
<form name= "form1 " method= "post " action= " ">
<input type= "text " name= "textfield " readonly(或者readonly="true", readonly=true, readonly="false" >
</form>
上面几种方法都不行。
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>timesheet</title>
<style type="text/css">
<!--
.STYLE5 { font-size: 16px;
font-weight: bold;
}
#Layer1 {
position:absolute;
width:997px;
height:115px;
z-index:1;
left: 143px;
top: 39px;
visibility: visible;
}
#Layer2 {
position:absolute;
width:200px;
height:115px;
z-index:2;
left: 984px;
top: 86px;
}
body {
background-color: #00CCFF;
}
#Layer3 {
position:absolute;
left:1019px;
top:107px;
width:90px;
height:54px;
z-index:2;
}
-->
</style>
<link href="../CSS/Level1_Arial.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE6 {font-size: 16px; font-weight: bold; font-family: "宋体"; }
.STYLE7 {font-family: "宋体"}
.STYLE10 {font-size: 14px}
-->
</style>
<script type="text/javascript">
function init(){
var x=[];
var a=new Date();
var m=a.getDay();
for(var i=m-1;i>=0;i--){
var y=a.getTime()-86400000*(m-1-i);
x[i]=new Date(y);
}
var b=document.getElementsByTagName("input");
for(i=m;i<=b.length;i++){
var y=a.getTime()+86400000*(i-m+1);
x[i]=new Date(y);
}
var hutia = 0;
for(var i=0;i<b.length;i++){
if(b[i].type=="text"){
b[i].value=(x[hutia].getMonth()+1)+"-"+x[hutia].getDate();
hutia++;
if (hutia > 6) break;
}
}
}
window.onload=init;
</script>
</head>
<body>
<table width="40" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../logo.gif" width="50" height="50" /></td>
</tr>
</table>
<table width="50" height="90" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center" class="STYLE5"><a href="../project/project-0426.html">项目</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE5"><a href="../report/reportsummary.html" target="_blank">总表</a></d