reload的时候使用get提交,而不用post,在提交的时候也不使用document.location.reload(),
而是直接写document.location.href=""在多加个参数,这样判断是否接收到这个参数来确认是否是刷新还是第一次进入该网页,来区分readOnly
而是直接写document.location.href=""在多加个参数,这样判断是否接收到这个参数来确认是否是刷新还是第一次进入该网页,来区分readOnly
解决方案 »
- extjs中用DWR调用java返回字符串放到panel的html中,求思路,谢谢
- 请教:该怎么实现日期分割?
- 关于javascript滚动文字脱节问题?
- document对象有createRange()方法吗?有的话,是什么意思?
- js判断输入,用正则表达式
- 续::一个简单的javascript问题--将一段javascript语句类化
- 图片按照任意角度旋转(至少能够按照90度旋转)——有较大难度,能解决问题就是牛
- html超连接问题
- 怎么才能在javascript程序中实现css样式的效果
- 如何让父窗口,访问它打开的子窗口的表单值
- 求教高人,document.getElementById("game_eval").run
- @_@ 在 JS 中如何实现 命名空间?
{
var a = document.uploadform.belongto;
a.disabled = a.disabled == true ? false : true;
}
function changetype()
{
if(document.forms[0].type[1].checked)
{
document.forms[0].belongto.disabled=false;
document.forms[0].projectname.disabled=true;
}else
{
document.forms[0].belongto.disabled=true;
document.forms[0].projectname.disabled=false;
}
}function init()
{
if(document.forms[0].type[1].checked)
{
document.forms[0].belongto.disabled=false;
document.forms[0].projectname.disabled=true;
}
}
</script>
你的方法可行,可是为什么我写的不可行啊,不是一样的么?hbhbhbhbhb1021(天外水火(我要多努力)) ( 三星(高级)) 你说的我不太懂he_8134(只有星星伴明月) ( 五级(中级)你把readonly改成disabled我用readonly前就是用的disabled但是也不行。不知道为什么matrixy的可行
你的问题可能在于你没有写上else语句(你的代码我没细看 ^_^ )
2.select没有readonly,只有disabled,另外disabled=true的对象,在提交表单的时候不会提上去。<html>
<head>
</head>
<script language="javascript">
function changetype()
{if(document.forms[0].type[1].checked)
{
document.forms[0].belongto.disabled=false;
document.forms[0].projectname.readOnly=true;
}
if(document.forms[0].type[0].checked)
{
document.forms[0].belongto.disabled=true;
document.forms[0].projectname.readOnly=false;
}
}function init()
{
if(document.forms[0].type[1].checked)
{document.forms[0].belongto.enabled="true";
document.forms[0].projectname.readOnly="true";
}
}
</script>
<body bgcolor="#66FF99" onload="init()">
<h1>文件上传</h1>
<form name="uploadform" method="POST" action="/SoftwareReuseLibrary/FileUpload" ENCTYPE="multipart/form-data">
<table border="1" cellpadding="4" width="800" cellspacing="2" bordercolor="#9BD7FF" align="center">
<tr>
<td>
<input type ="radio" name="type" value="new" onclick="changetype()">新项目上传</input>
<input type ="radio" name="type" value="update" checked onclick="changetype()">更新已有项目</input>
</td>
</tr>
<tr>
<td>新项目名称:<input type="text" name="projectname"/></td>
</tr>
<tr>
<td>
请选择上传文件所属的项目:
<select name="belongto">
<option value="null" selected="selected">----------</option>
<option value="1">111111</option>
</select>
</td>
</tr> <tr><td colspan="2">
请选择你需要上传的文件:<input name="x" size="40" type="file"/>
</td>
</tr><tr>
<td>
文件功能描述:<br/>
<textarea name="fd" cols="50" rows="20"></textarea>
</td></tr><tr><td>
作者:<input type="text" name="author"/></td></tr>
<tr><td align="center"><input name="upload" type="submit" value="开始上传"/></td></tr>
</table>
</form>
</body>
</html>
document.forms[0].projectname.readOnly=false;