html整理

来源:互联网 发布:空总激光美容中心 知乎 编辑:程序博客网 时间:2024/05/16 06:40

setTimeout:

<html><head><title>倒计时</title></head><body><form id="formName" name="formName" method="post" action=""><input type="submit" name="Submit" value="OK" /></form><script language="javascript">document.formName.Submit.disabled = true;var wait = 10; //停留时间function updateinfo(){  if(wait == 0){document.formName.Submit.value = "提交";document.formName.Submit.disabled = false;  } else {document.formName.Submit.value = "现在是"+wait;wait--;window.setTimeout("updateinfo()",1000);  }}updateinfo();</script></body></html>
textarea:
<html><head><script type="text/javascript">function disable(){      document.getElementById('txta').disabled=true;  }function enable(){      document.getElementById('txta').disabled=false;  }</script></head><body><form><textarea id="txta">这是一个textarea框,现在来测试disable</textarea><br/><input type="button" onclick="disable()" value="disable" /><input type="button" onclick="enable()" value="enable" /></form></body></html>