Google和百度、雅虎的站内搜索代码
[
2007/10/18 17:30 | by sunle ]
2007/10/18 17:30 | by sunle ]
对于一个网站来说,使用搜索引擎来进行站内搜索往往比自己编写的站内搜索更高效,并且不占用网站服务器的资源,下面是我搜集到的几个主要搜索引擎(Google和百度、雅虎)的站内搜索代码,使用时只需要将代码里的"www.sunle.net"替换成你的网址即可。
EditPlus中快速删除多余的空行
[
2007/09/27 16:57 | by sunle ]
2007/09/27 16:57 | by sunle ]
正则表达式 替换 \n\n 换 \n
正则表达式 替换 ^[\s]*\n
收集于网络的Web Standard规范化CSS XHTML命名
[
2007/09/17 13:39 | by sunle ]
2007/09/17 13:39 | by sunle ]
CSS命名规则
头:header
内容:content/containe
尾:footer
导航:nav
侧栏:sidebar
栏目:column
页面外围控制整体布局宽度:wrapper
左右中:left right center
登录条:loginbar
头:header
内容:content/containe
尾:footer
导航:nav
侧栏:sidebar
栏目:column
页面外围控制整体布局宽度:wrapper
左右中:left right center
登录条:loginbar
更换域名但访问地址不变的转向代码
[
2007/09/10 20:49 | by sunle ]
2007/09/10 20:49 | by sunle ]
<script language="javascript">
var newdomain="www.sunle.net"; //新域名,例如说跳到 www.sunle.net
var stoptime=0; //页面停留时间,以秒为单位
var My_Url=document.location.href;
godomain();
function godomain()
{
var str=My_Url;
stag=str.indexOf('//')+1;
str=str.substring(stag+1,str.length)
stag=str.indexOf('/');
rstr=str.substring(0,stag);
olddomain=rstr;
My_Url=My_Url.replace(olddomain,newdomain);
setTimeout("gourl()",stoptime*1000);
}
function gourl()
{window.location=My_Url;}
</script>
var newdomain="www.sunle.net"; //新域名,例如说跳到 www.sunle.net
var stoptime=0; //页面停留时间,以秒为单位
var My_Url=document.location.href;
godomain();
function godomain()
{
var str=My_Url;
stag=str.indexOf('//')+1;
str=str.substring(stag+1,str.length)
stag=str.indexOf('/');
rstr=str.substring(0,stag);
olddomain=rstr;
My_Url=My_Url.replace(olddomain,newdomain);
setTimeout("gourl()",stoptime*1000);
}
function gourl()
{window.location=My_Url;}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.content_12pt{
font-size:14px;
color:#000000;
line-height: 20px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
text-align: justify;
margin-top: 0;
margin-bottom:0;
vertical-align:top;
}
.ContentHighlight{
display:block;
float: left;
font-size:39px;
color: #990000;
width: 40px;
height: 36px;
line-height:36px;
+line-height:40px !important;
_line-height:40px;
padding:0;
margin:0;
}
-->
</style>
</head>
<body>
<p class='ContentHighlight'>第</p><span class='content_12pt'> 正文 </span>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.content_12pt{
font-size:14px;
color:#000000;
line-height: 20px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
text-align: justify;
margin-top: 0;
margin-bottom:0;
vertical-align:top;
}
.ContentHighlight{
display:block;
float: left;
font-size:39px;
color: #990000;
width: 40px;
height: 36px;
line-height:36px;
+line-height:40px !important;
_line-height:40px;
padding:0;
margin:0;
}
-->
</style>
</head>
<body>
<p class='ContentHighlight'>第</p><span class='content_12pt'> 正文 </span>
</body>
</html>
<script language=javascript>
window.navigate('HTTP://WWW.SUNLE.NET');
</script>
<script language='javascript'>location.href='http://www.sunle.net/';</script>
window.navigate('HTTP://WWW.SUNLE.NET');
</script>
<script language='javascript'>location.href='http://www.sunle.net/';</script>
网页内图片限制最大宽度 大小缩放
[
2007/08/25 11:15 | by sunle ]
2007/08/25 11:15 | by sunle ]
<SCRIPT language=JavaScript type=text/JavaScript>
//改变图片大小
function resizepic(o)
{
var maxwidth=700; //定义最大宽度
var maxheight=2000; //定义最大高度
var a=new Image();
a.src=o.src
if(a.width > maxwidth)
{
o.style.width=maxwidth;
}
if (a.height> maxheight)
{
o.style.height=maxheight;
}
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT>
//改变图片大小
function resizepic(o)
{
var maxwidth=700; //定义最大宽度
var maxheight=2000; //定义最大高度
var a=new Image();
a.src=o.src
if(a.width > maxwidth)
{
o.style.width=maxwidth;
}
if (a.height> maxheight)
{
o.style.height=maxheight;
}
}
//无级缩放图片大小
function bbimg(o)
{
var zoom=parseInt(o.style.zoom, 10)||100;
zoom+=event.wheelDelta/12;
if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</SCRIPT>
多个绑定多域名的PHP代码
[
2007/08/07 14:30 | by sunle ]
2007/08/07 14:30 | by sunle ]
第一个:
if($HTTP_HOST=="www.moon-soft.com"){
Header("Location: moon.htm");
}
elseif($HTTP_HOST=="www.williamlong.info"){
Header("Location: williamlong.htm");
}
else{
Header("Location: other.htm");
}
第二个:
if($HTTP_HOST=="www.moon-soft.com"){
require "moon.htm";
}
elseif($HTTP_HOST=="www.williamlong.info"){
require "williamlong.htm";
}
else{
require "other.htm";
}
if($HTTP_HOST=="www.moon-soft.com"){
Header("Location: moon.htm");
}
elseif($HTTP_HOST=="www.williamlong.info"){
Header("Location: williamlong.htm");
}
else{
Header("Location: other.htm");
}
第二个:
if($HTTP_HOST=="www.moon-soft.com"){
require "moon.htm";
}
elseif($HTTP_HOST=="www.williamlong.info"){
require "williamlong.htm";
}
else{
require "other.htm";
}







