记录一些常用的JS CSS,方便以后用到时查找
<meta http-equiv="refresh" content="0;url=http://www.lanrentuku.com">
2.网页中如何让整段文字左右对齐
<div style="font-size:12px;width:300;text-align:justify; text-justify:inter-ideograph">
修改这个试一下!!
4.屏蔽鼠标右键
oncontextmenu="window.event.returnvalue=false"
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
5. 取消选取、防止复制<body onselectstart="return false">
6.不准粘贴 onpaste="return false"
7.防止复制 oncopy="return false;" oncut="return false;"
8. IE地址栏前换成自己的图标 <link rel="Shortcut Icon" href="favicon.ico">
9.可以在收藏夹中显示出你的图标<link rel="Bookmark" href="favicon.ico">
10.关闭输入法<input style="ime-mode:disabled">
11. 网页将不能被另存为<noscript><iframe src=*.html></iframe></noscript>
12.查看网页源代码
<input type=button value=查看网页源代码
onclick="window.location = 'view-source:'+ 'http://oschina.net/'">
13.通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
14. 防止被人frame
<script LANGUAGE=javascript><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
15.永远都会带着框架
<script language="javascript"><!--
if (window == top)top.location.href = "frames.htm"; file://frames.htm为框架网页
// --></script>
16.设置页面不缓存
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
17.获取下拉列表值
<select size="1" id="selt">
<option value="1">Java网络编程学习资料</option>
<option value="2">Java深度历险</option>
<option value="3">Java完美编程</option>
</select>
<input type="button" value="提交" onclick="doSubmitForm()">
<script language=javascript type=text/javascript>
function doSubmitForm(id)
{
var theele = document.getElementById('selt');
var content= theele.options[theele.selectedIndex].innerHTML;
alert(content);
theele.selectedIndex=theele.selectedIndex;
}
18.ul标签
通过权衡得到适合两个浏览器的设置:padding:0; margin:0; list-style:inside;。还可以将ul设置为padding:0; margin:0; list-style:none;,然后给li添加背景图片,也是很不错的选择。
19.去掉img间隔