<
<tr>
function substrgb($in,$num){
$pos=0;
$out="";
while($c=substr($in,$pos,1)){
if($c=="\n") break;
if(ord($c)>128){
$out.=$c;
$pos++;
$c=substr($in,$pos,1);
$out.=$c;
<td height="100" bgcolor="f4f4f4"> </td>
</tr>
</table>
43.后退&关闭窗口
后退:javascript:history.back(1)
关闭:javascript:window.close();
<tr>
<td height="100" bgcolor="f4f4f4"> </td>
</tr>
</table>
43.后退&关闭窗口
后退:javascript:history.back(1)
关闭:javascript:window.close();
<a href="www.lenvo.cnhttp://www.lenvo.cn/">www.lenvo.cn</a></font>
</div>
42.给表格做链接
<table width="100%" οnclick="window.open('http://www.makewing.com/', '_blank')" style="CURSOR:hand">
<tr>
<td height="100" bgcolor="f4f4f4"> </td>
</tr>
</table>
43.后退&关闭窗口
后退:javascript:history.back(1)
关闭:javascript:window.close();
44.如果文字过长,则将过长的部分变成省略号显示
<DIV STYLE="width: 120px; height: 50px; border: 0px solid blue;overflow: hidden; text-overflow:ellipsis">
<NOBR>就是比如有一行文字,很长,表格内一行显示不下.</NOBR>
</DIV>
45.禁止复制,鼠标拖动选取
<body οndragstart=window.event.returnValue=false οncοntextmenu=window.event.returnValue=false onselectstart=event.returnValue=false>
46.代码中断处理
<?php
if(isset($_REQUEST["action_type"]) && $_REQUEST["action_type"]== "login")
{
要执行的脚本
}
php?>
该脚本如同asp中的
<%
if request("action")="" then
要执行的脚本
end if
%>
防止sql字符串攻击
function inject_check($str1) {
//验证传入的参数中是否含有注入字符
return preg_match('/select|insert|and|or|update|delete|union|into|load_file|outfile|from|count\(|drop table|update|truncate|asc\(|mid\(|char\(|xp_cmdshell|exec|master|\/\*|\*|\.\.\/|\.\//i', $str1);
}
?=substrgb($rs["title"],10)?>
function substrgb($in,$num){
$pos=0;
$out="";
while($c=substr($in,$pos,1)){
if($c=="\n") break;
if(ord($c)>128){
$out.=$c;
$pos++;
$c=substr($in,$pos,1);
$out.=$c;
}else{
$out.=$c;
}
$pos++;
if($pos>=$num) break;
}
if($out!=$in) $out = $out . "...";
return $out;
}
18、判断是否是数字
!is_numeric(qq)
19、PHP技术中获取当前日期
$ptime=date("y-m-d");
20、用户注册时所使用的PHP验证程序
if ($admin=="" or (strlen($admin)>16) or (strlen($admin)<2)) {
echo "<SCRIPT language=JavaScript>alert('请输入用户名(不能大于16小于2)');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($password=="" or strlen($password)>16 or strlen($password)<6) {
echo "<SCRIPT language=JavaScript>alert('密码长度为6-16个字符');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($password=="") {
echo "<SCRIPT language=JavaScript>alert('确认密码不能为空');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}else{
if ($password!=$password1) {
echo "<SCRIPT language=JavaScript>alert('密码和确认密码不一致');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
}
if ($wt="") {
echo "<SCRIPT language=JavaScript>alert('密码问题不能为空');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($da="") {
echo "<SCRIPT language=JavaScript>alert('问题答案不能为空');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($qq!="") {
if (!is_numeric($qq)) {
echo "<SCRIPT language=JavaScript>alert('QQ号码必须是数字');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
}
if ($youbian=="" or strlen($youbian)!=6) {
echo "<SCRIPT language=JavaScript>alert('请正确输入邮编');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($youbian!="") {
if (!is_numeric($youbian)) {
echo "<SCRIPT language=JavaScript>alert('邮编必须是数字');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
}
if ($dizhi="") {
echo "<SCRIPT language=JavaScript>alert('住址不能为空');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($mail=="") {
echo "<SCRIPT language=JavaScript>alert('E-mail不能为空!');";
echo "this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($textarea=="") {
echo "<SCRIPT language=JavaScript>alert('个人说明不能为空!');";
echo "this.location.href='vbscript:history.back()';</SCRIPT>";
}
if ($textarea=="" or strlen(textarea)>150) {
echo "<SCRIPT language=JavaScript>alert('个人说明为150个字符');";
echo"this.location.href='vbscript:history.back()';</SCRIPT>";
}
24、对输出的内容进行判断,从而输出其它结果
<?php if ($rs["active"]==1) { echo "<font color='#ff0000'>激活</font>"; }else{ echo "禁用"; } ?>
25.字符截取函数
<?=substr("$rs[zixun_biaoti]",0,28)?>
26.男女问题或单选带选择的
<input type="radio" name="hy_zhuangtai" value="男" <?php if ($rs["hy_zhungtai"]==="男") { echo "checked";}?>>男
<input type="radio" name="hy_zhuangtai" value="女" <?php if ($rs["hy_zhuangtai"]==="女") { echo "checked";}?>>女
27.单选不带单选框的
<?php if ($rs['hy_zhuangtai']=='锁定'){?>
<a href="Userzt.php?action=yes&id=<?php echo $rs['hy_id'];?>">锁定</a>
<?php }
else{?>
<a href="Userzt.php?id=<?php echo $rs['hy_id'];?>&action=no">解锁</a>
<?php }?>
它的 save页是
<?php require_once('http://www.cnblogs.com/conn.php'); ?>
<?php
$hy_id=$_GET['id'];
$action=$_GET['action'];
if ($action=='yes'){
$sql="update hybiao set hy_zhuangtai='锁定' where hy_id='$id'";
$query=mysql_query($sql,$connec);
echo("<script type='text/javascript'>location.href='UserManage.php';</script>");
}
else{
$sql="update hybiao set hy_zhuangtai='正常' where hy_id='$id'";
$query=mysql_query($sql,$connec);
echo("<script type='text/javascript'>location.href='UserManage.php';</script>");
}
mysql_close();
?>
28. 如果文字过长,则将过长的部分变成省略号显示
<DIV STYLE="width: 120px; height: 50px; border: 0px solid blue;overflow: hidden; text-overflow:ellipsis">
<NOBR> 就是比如有一行文字,很长,表格内一行显示不下.</NOBR>
</DIV>
29.
禁止复制,鼠标拖动选取
<body οndragstart=window.event.returnValue=false οncοntextmenu=window.event.returnValue=false onselectstart=event.returnValue=false>
30.大 中 小 文字的变化
<script type="text/javascript">
function doZoom(size)
{document.getElementById('zoom').style.fontSize=size+'px';}
</script>
<span id="zoom">需要指定大小的文字</span>
<a href="javascript:doZoom(16)">大</a> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a>
30.添加到收藏夹和设为首页
<a href=# οnclick="this.style.behavior='url(#default#homepage)'; this.setHomePage('http://www.makewing.com/lanren/');">设为首页</a>
<a href="javascript:window.external.AddFavorite('http://www.makewing.com /lanren/','懒人图库')">收藏本站</a>
31.记录并显示网页的最后修改时间
<script language=JavaScript>
document.write("最后更新时间: " + document.lastModified + "")
</script>
32.节日倒计时
<Script Language="JavaScript">
var timedate= new Date("October 1,2002");
var times= "国庆节";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24));
if (time >= 0)
document.write( "现在离"+times+"还有: "+time +"天")
</Script>
33.打开窗口即最大化
<script language="JavaScript">
<!-- Begin
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
// End -->
</script>
34.加入背景音乐
<bgsound src="mid/windblue[1].mid" loop="-1"> 只适用于IE
<embed src="music.mid" autostart="true" loop="true" hidden="true"> 对Netscape ,IE 都适用
35.滚动
<marquee direction=up height=146 οnmοuseοut=start() οnmοuseοver=stop() scrollAmount=2>
滚动信息
</marquee>
36.防止点击空链接时,页面往往重置到页首端
代码“javascript:void(null)”代替原来的“#”标记
37.不能点右键,不用CTRL+A,不能复制作!
<body οncοntextmenu="window.event.returnValue=false"
οnkeypress="window.event.returnValue=false"
οnkeydοwn="window.event.returnValue=false"
οnkeyup="window.event.returnValue=false"
οndragstart="window.event.returnValue=false"
onselectstart="event.returnValue=false">
</body>
37.随机变换背景图象(一个可以刷新心情的特效)
<Script Language="JavaScript">
image = new Array(4); //定义image为图片数量的数组
image [0] = 'tu0.gif' //背景图象的路径
image [1] = 'tu1.gif'
image [2] = 'tu2.gif'
image [3] = 'tu3.gif'
image [4] = 'tu4.gif'
number = Math.floor(Math.random() * image.length);
document.write("<BODY BACKGROUND="+image[number]+">");
</Script>
38.划过链接 手型鼠标
style="cursor:hand"
39.如何关闭层
<div id="Layer1"></div>
<a href="#" onClick="Layer1.style.display='none'">关闭层</a>
40.<a href=javascript:close()>[关闭窗口]</a>
41.凹陷文字背景为灰色
<div style="width:300px;padding:20px;overflow:hidden;word-wrap:break-word;word-break:break:all; font-size:12px; line-height:18px; background-color:#eeeeee;">
<font disabled>
怎么样,我凹下去了吧?<br>
你不想试试吗?<br>
<a href="www.lenvo.cnhttp://www.lenvo.cn/">www.lenvo.cn</a></font>
</div>
42.给表格做链接
<table width="100%" οnclick="window.open('http://www.makewing.com/', '_blank')" style="CURSOR:hand">
<tr>
<td height="100" bgcolor="f4f4f4"> </td>
</tr>
</table>
43.后退&关闭窗口
后退:javascript:history.back(1)
关闭:javascript:window.close();
44.如果文字过长,则将过长的部分变成省略号显示
<DIV STYLE="width: 120px; height: 50px; border: 0px solid blue;overflow: hidden; text-overflow:ellipsis">
<NOBR>就是比如有一行文字,很长,表格内一行显示不下.</NOBR>
</DIV>
45.禁止复制,鼠标拖动选取
<body οndragstart=window.event.returnValue=false οncοntextmenu=window.event.returnValue=false onselectstart=event.returnValue=false>
46.代码中断处理
<?php
if(isset($_REQUEST["action_type"]) && $_REQUEST["action_type"]== "login")
{
要执行的脚本
}
php?>
该脚本如同asp中的
<%
if request("action")="" then
要执行的脚本
end if
%>
防止sql字符串攻击
function inject_check($str1) {
//验证传入的参数中是否含有注入字符
return preg_match('/select|insert|and|or|update|delete|union|into|load_file|outfile|from|count\(|drop table|update|truncate|asc\(|mid\(|char\(|xp_cmdshell|exec|master|\/\*|\*|\.\.\/|\.\//i', $str1);
}