还是老话,不要直接在html中写js代码

修改input,onclick事件,点击后,submit变灰

<form action="http://www.baidu.com" method="POST">
<input name="T1" size="20" type="text" />
<input onclick="javascript:{this.disabled=true;document.form1.submit();}" type="button" value="提交" />
<input name="B2" type="reset" value="重置" />
</form>

鼠标划过,变色!

<table border="1" width="200">
<tbody>
<tr onmouseover="this.bgColor='#666666'" onmouseout="this.bgColor='#FFFFFF'">
<td>1</td>
</tr>
<tr onmouseover="this.bgColor='#666666'" onmouseout="this.bgColor='#FFFFFF'">
<td>2</td>
</tr>
</tbody>
</table>

鼠标选定后改变input的value值

<input id="q" type="text" value="Search" style="color:#ccc" 
onblur="if(this.value=='') {this.value='Search';this.style.color='#ccc';}" 
onfocus="if(this.value=='Search') {this.value='';}this.style.color='#333';" />

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2021-07-20
  • 2021-07-09
猜你喜欢
  • 2021-08-31
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
  • 2021-07-17
相关资源
相似解决方案