html常用代码

让英文字符串超出表格宽度自动换行
<td style="word-wrap:break-word; word-break:break-all;">

永远都会带着框架
<script language="JavaScript">
<!--
if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
// -->
</script>

防止被人frame
<SCRIPT LANGUAGE=JAVASCRIPT>
<!--
if (top.location != self.location)top.location=self.location;
// -->
</SCRIPT>

网页将不能被另存为
<noscript><iframe src=*.html></iframe></noscript>

删除时确认
<a href='javascript:if(confirm("确实要删除吗?"))location="del.asp"'>删除</a>

不要滚动条
让竖条没有:
<body style='overflow:scroll;overflow-y:hidden'>
</body>
让横条没有:
<body style='overflow:scroll;overflow-x:hidden'>
</body>
两个都去掉?更简单了:
<body scroll="no">
</body>

鼠标划过,表格变色
<tr οnmοuseοver="this.bgColor='red'" οnmοuseοut="this.bgColor=''">

屏蔽右键
<body οncοntextmenu="return false;">

<script language="JavaScript">
<!--
if (window.Event)
  document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
 event.cancelBubble = true
 event.returnValue = false;
 return false;
}
function norightclick(e)
{
 if (window.Event)
 {
  if (e.which == 2 || e.which == 3)
   return false;
 }
 else
  if (event.button == 2 || event.button == 3)
  {
   event.cancelBubble = true
   event.returnValue = false;
   return false;
  }
}
document.oncontextmenu = nocontextmenu;  // for IE5+
document.onmousedown = norightclick;  // for all others
//-->
</script>


用正则强制输入数字
<input name="id2" type="text" οnkeyup='this.value=this.value.replace(//D/gi,"")'>

禁止输入中文
<input type=text style="ime-mode: disabled ">

不允许文本框自动完成
<input autocomplete=off>

图片变灰,掠过恢复
<img src="http://community.csdn.net/images/csdn.gif"style="filter:gray"onmo ... "this.style.filter='gray'">

定时跳转到其它页面
<meta http-equiv="refresh" content="5;URL=http://54caizi.com">

TITLE换行
<a href=# title="第一行&#13;第二行&#13;第三行">title分行测试</a>

行背景色渐变
<table width="100%" height="100%">
<tr><td style="FILTER: progid:DXImageTransform.Microsoft.Gradient(endColorstr='#EFF3FF', startColorstr='#94B2F7', gradientType='1')" ></td></tr>
</table>
说明:
功能从startcolorstr渐变到endcolorstr
gardientType 是填充样式,具体值请自己尝试

调用其它页面
<object type="text/x-scriptlet" width="800" height="1000" data="a.htm"></object>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值