搜索

最新评论

友情博客

RSS

我的 Blog:
candy2004 最新的 20 条日志
[心情日记]
[设计理念]
[我的音乐]
[时尚生活]
[经典收藏]
[天方夜谈]
全站 Blog:
全站最新的 20 条日志
 
一些常用代码

让英文字符串超出表格宽度自动换行
<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 onmouseover="this.bgColor='red'" onmouseout="this.bgColor=''">

屏蔽右键
<body oncontextmenu="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" onkeyup='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" onmouseover=&q ... sp;onmouseout="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>

SC大眼睛 发表于 2005-5-31  [所属栏目:经典收藏 | 返回首页]
小字体中字体大字体
评论(共 {Count} 条)
{CommentAuthor}:
{CommentTime}
{CommentUrl}
{CommentEmail}
{CommentIp}
{CommentContent}