JS tips~ 备用

还是老话,不要直接在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';" />
posted on 2011-09-05 05:41  之乎者也2011 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/wrmfw/archive/2011/09/05/2166950.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值