<!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>无标题文档</title>
<script language="javascript">
window.onload=function(){
var fm=document.fm;
var bt=fm.su;
var re=fm.re;
re.onclick=function(){
if(window.confirm("您确要删除吗?"))
fm.content.value="";
else
return false;
}
bt.onclick=function(){
content=fm.content.value;
win=window.open("","target")
win.document.write(content)
}
};
</script>
</head><body>
<form name="fm">
<textarea name="content" cols="20" rows="10" >ddd
</textarea>
<br />
<input type="button" name="su" value="ff" />
<br />
<input type="button" name="re" value="dd" />
</form></body>
</html> fm.content.value=""; 有效果,, 我使用 fm.reset();重置 怎么没有效果呢??? 相当于清除,,但就是没有效果
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
window.onload=function(){
var fm=document.fm;
var bt=fm.su;
var re=fm.re;
re.onclick=function(){
if(window.confirm("您确要删除吗?"))
fm.content.value="";
else
return false;
}
bt.onclick=function(){
content=fm.content.value;
win=window.open("","target")
win.document.write(content)
}
};
</script>
</head><body>
<form name="fm">
<textarea name="content" cols="20" rows="10" >ddd
</textarea>
<br />
<input type="button" name="su" value="ff" />
<br />
<input type="button" name="re" value="dd" />
</form></body>
</html> fm.content.value=""; 有效果,, 我使用 fm.reset();重置 怎么没有效果呢??? 相当于清除,,但就是没有效果
</textarea>已经有了初始值"ddd",fm.reset();相当于回复到初始状态,即回复到ddd状态。如果你在打开网页的时候在"ddd"后边手动输入一些文字然后在点击【dd】按钮调用fm.reset()就能看到到效果了。