php+ajax无刷新实现省、地、市三级联动二
<?
$conn=mysql_connect("localhost","root","2328725");
mysql_select_db("novel");
mysql_query("set names 'utf8'");
if($provincecode!=""&&$provincecode!=650000&&$provincecode!=710000&&$provincecode!=810000&&$provincecode!=820000&&$provincecode!=110000&&$provincecode!=120000&&$provincecode!=310000&&$provincecode!=500000){
$sql="select * from city where provincecode=$provincecode";
$result=mysql_query($sql);
echo "<select onchange='queryArea(this.options[this.selectedIndex].value)'>\n";
echo "<option value='-1' selected>请选择城市</option>\n";
while($row=mysql_fetch_row($result)){
echo "<option value='$row[1]'>$row[2]</option>\n";
}
echo "</select>\n";
}
if($citycode!=""){
$sql="select * from area where citycode=$citycode";
$result=mysql_query($sql);
echo "<select>\n";
echo "<option value='-1' selected>请选择县</option>\n";
while($row=mysql_fetch_row($result)){
echo "<option value='$row[1]'>$row[2]</option>\n";
}
echo "</select>\n";
}
?>
<?php
/*****************************************
Title :smarty结合xajax检测用户名简单实例
Author:leehui1983(辉老大)
Finish Date :2006-12-09
*****************************************/
//为避免中文乱码,需要在 xajax.inc.php 需要改一下默认的encoding:define ('XAJAX_DEFAULT_CHAR_ENCODING', 'gbk' )UTF8编码格式文件不需要更改
require_once('./libs/Smarty.class.php');//包含smarty类库
require('./xajax/xajax.inc.php');//包含xajax类库
function checkusername($textvalue){//编写需要的PHP函数
$checkresult=($textvalue=='test' ? '<font color=red>该用户名已经注册</font>' :'<font color=red>可以注册</font>');
$objresponse=new xajaxResponse();//实例化xajaxresponse对象
$objresponse->addassign("result","innerHTML",$checkresult);//指定ID为result的元素中添加内容$checkresult
return $objresponse;//返回结果文本
}
$xajax=new xajax();//实例化xajax对象
$smarty=new Smarty();//实例化smarty对象
$smarty->template_dir = "./templates";//设置模板目录
$smarty->compile_dir = "./templates_c"; //设置编译目录
$smarty->caching = false; //设置缓存方式
/*****************************************************
左右边界符,默认为{},但实际应用当中容易与JavaScript
相冲突,所以建议设成<{}>或其它。
*****************************************************/
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$xajax->registerFunction("checkusername");//注册checkusername函数
$xajax->processRequests();//调用xajax用于接管请求
$smarty->assign('xajax_javascript', $xajax->getJavascript('./xajax/'));//输出JS代码,注意('./xajax/')中参数为xajax.inc.php父目录,在同意目录下可不同填写,否则必须填写
$smarty->assign('title','smarty结合xajax检测用户名简单实例');//替换模板内容
$smarty->display('index.tpl');//显示模板内容
?>
<html>
<head>
<title><{$title}></title>
<{$xajax_javascript}><{*使smarty支持xajax*}>
</head>
<body>
<form name="check" >
请输入用户名:
<input type="text" name="username" />
<input type="button" name="button" value="检查用户名" />
<div id="result"></div>
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" c />
<script type="text/javascript">
var xmlHttp;
var requestType="";
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
}
function queryCity(citycode){
createXMLHttpRequest();
type="city";
var url="data.php?provincecode="+citycode;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.send(null);
}
function queryArea(citycode){
createXMLHttpRequest();
type="area";
var url="data.php?citycode="+citycode;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.send(null);
}
function handleStateChange(){
if(xmlHttp.readystate==4){
if(xmlHttp.status==200){
if(type=="city"){
showcity();
}else if(type="area"){
showarea();
}
}
}
}
function showcity(){
document.getElementById("city").innerHTML=xmlHttp.responseText;
document.getElementById("area").innerHTML="";
}
function showarea(){
document.getElementById("area").innerHTML=xmlHttp.responseText;
}
</script>
</head>
<body>
<?
$conn=mysql_connect("localhost","root","2328725");
mysql_select_db("novel");
mysql_query("set names 'utf8'");
$sql="select * from province";
$result=mysql_query($sql);
echo "<from id='form1'>\n";
echo "<select id='province' onchange='queryCity(this.options[this.selectedIndex].value)'>\n";
echo "<option value='-1' selected>请选择省份</option>\n";
while($row=mysql_fetch_row($result)){
echo "<option value='$row[1]'>$row[2]</option>\n";
}
echo "</select>\n";
echo "<span id='city'></span>\n";
echo "<span id='area'></span>\n";
echo "</form>\n";
?>
</body>
</html>
<?
function _countMaskPos()
{
if($this->_isFull())
{
switch($this->mask_position)
{
case 1:
// 左上
$this->mask_pos_x = $this->mask_offset_x + $this->img_border_size;
$this->mask_pos_y = $this->mask_offset_y + $this->img_border_size;
break;
case 2:
// 左下
$this->mask_pos_x = $this->mask_offset_x + $this->img_border_size;
$this->mask_pos_y = $this->src_h - $this->mask_h - $this->mask_offset_y;
break;
case 3:
// 右上
$this->mask_pos_x = $this->src_w - $this->mask_w - $this->mask_offset_x;
$this->mask_pos_y = $this->mask_offset_y + $this->img_border_size;
break;
case 4:
// 右下
$this->mask_pos_x = $this->src_w - $this->mask_w - $this->mask_offset_x;
$this->mask_pos_y = $this->src_h - $this->mask_h - $this->mask_offset_y;
break;
default:
// 默认将水印放到右下,偏移指定像素
$this->mask_pos_x = $this->src_w - $this->mask_w - $this->mask_offset_x;
$this->mask_pos_y = $this->src_h - $this->mask_h - $this->mask_offset_y;
break;
}
}
else
{
switch($this->mask_position)
{
case 1:
// 左上
$this->mask_pos_x = $this->mask_offset_x + $this->img_border_size;
$this->mask_pos_y = $this->mask_offset_y + $this->img_border_size;
break;
case 2:
// 左下
$this->mask_pos_x = $this->mask_offset_x + $this->img_border_size;
$this->mask_pos_y = $this->dst_h - $this->mask_h - $this->mask_offset_y - $this->img_border_size;
break;
case 3:
// 右上
$this->mask_pos_x = $this->dst_w - $this->mask_w - $this->mask_offset_x - $this->img_border_size;
$this->mask_pos_y = $this->mask_offset_y + $this->img_border_size;
break;
case 4:
// 右下
$this->mask_pos_x = $this->dst_w - $this->mask_w - $this->mask_offset_x - $this->img_border_size;
$this->mask_pos_y = $this->dst_h - $this->mask_h - $this->mask_offset_y - $this->img_border_size;
break;
default:
// 默认将水印放到右下,偏移指定像素
$this->mask_pos_x = $this->dst_w - $this->mask_w - $this->mask_offset_x - $this->img_border_size;
$this->mask_pos_y = $this->dst_h - $this->mask_h - $this->mask_offset_y - $this->img_border_size;
break;
}
}
}
/**
* 设置字体信息
*/
function _setFontInfo()
{
if(is_numeric($this->font))
{
$this->font_w = imagefontwidth($this->font);
$this->font_h = imagefontheight($this->font);
// 计算水印字体所占宽高
$word_length = strlen($this->mask_word);
$this->mask_w = $this->font_w*$word_length;
$this->mask_h = $this->font_h;
}
else
{
$arr = imagettfbbox ($this->font_size,0, $this->font,$this->mask_word);
$this->mask_w = abs($arr[0] - $arr[2]);
$this->mask_h = abs($arr[7] - $arr[1]);
}
}
/**
* 设置新图尺寸
*
* @param integer $img_w 目标宽度
* @param integer $img_h 目标高度
*/
function _setNewImgSize($img_w, $img_h=null)
{
$num = func_num_args();
if(1 == $num)
{
$this->img_scale = $img_w;// 宽度作为比例
$this->fill_w = round($this->src_w * $this->img_scale / 100) - $this->img_border_size*2;
$this->fill_h = round($this->src_h * $this->img_scale / 100) - $this->img_border_size*2;
// 源文件起始坐标
$this->src_x = 0;
$this->src_y = 0;
$this->copy_w = $this->src_w;
$this->copy_h = $this->src_h;
// 目标尺寸
$this->dst_w = $this->fill_w + $this->img_border_size*2;
$this->dst_h = $this->fill_h + $this->img_border_size*2;
}
if(2 == $num)
{
$fill_w = (int)$img_w - $this->img_border_size*2;
$fill_h = (int)$img_h - $this->img_border_size*2;
if($fill_w < 0 || $fill_h < 0)
{
die("图片边框过大,已超过了图片的宽度");
}
$rate_w = $this->src_w/$fill_w;
$rate_h = $this->src_h/$fill_h;
switch($this->cut_type)
{
case 0:
// 如果原图大于缩略图,产生缩小,否则不缩小
if($rate_w < 1 && $rate_h < 1)
{
$this->fill_w = (int)$this->src_w;
$this->fill_h = (int)$this->src_h;
}
else
{
if($rate_w >= $rate_h)
{
$this->fill_w = (int)$fill_w;
$this->fill_h = round($this->src_h/$rate_w);
}
else
{
$this->fill_w = round($this->src_w/$rate_h);
$this->fill_h = (int)$fill_h;
}
}
$this->src_x = 0;
$this->src_y = 0;
$this->copy_w = $this->src_w;
$this->copy_h = $this->src_h;
// 目标尺寸
$this->dst_w = $this->fill_w + $this->img_border_size*2;
$this->dst_h = $this->fill_h + $this->img_border_size*2 - 10 ;//补偿round误差 消除白边;
break;
// 自动裁切
case 1:
// 如果图片是缩小剪切才进行操作
if($rate_w >= 1 && $rate_h >=1)
{
if($this->src_w > $this->src_h)
{
$src_x = round($this->src_w-$this->src_h)/2;
$this->setSrcCutPosition($src_x, 0);
$this->setRectangleCut($fill_h, $fill_h);
$this->copy_w = $this->src_h;
$this->copy_h = $this->src_h;
}
elseif($this->src_w < $this->src_h)
{
$src_y = round($this->src_h-$this->src_w)/2;
$this->setSrcCutPosition(0, $src_y);
$this->setRectangleCut($fill_w, $fill_h);
$this->copy_w = $this->src_w;
$this->copy_h = $this->src_w;
}
else
{
$this->setSrcCutPosition(0, 0);
$this->copy_w = $this->src_w;
$this->copy_h = $this->src_w;
$this->setRectangleCut($fill_w, $fill_h);
}
}
else
{
$this->setSrcCutPosition(0, 0);
$this->setRectangleCut($this->src_w, $this->src_h);
$this->copy_w = $this->src_w;
$this->copy_h = $this->src_h;
}
// 目标尺寸
$this->dst_w = $this->fill_w + $this->img_border_size*2;
$this->dst_h = $this->fill_h + $this->img_border_size*2;
break;
// 手工裁切
case 2:
$this->copy_w = $this->fill_w;
$this->copy_h = $this->fill_h;
// 目标尺寸
$this->dst_w = $this->fill_w + $this->img_border_size*2;
$this->dst_h = $this->fill_h + $this->img_border_size*2;
break;
default:
break;
}
}
// 目标文件起始坐标
$this->start_x = $this->img_border_size;
$this->start_y = $this->img_border_size;
}
/**
* 检查水印图是否大于生成后的图片宽高
*/
function _isFull()
{
Return ( $this->mask_w + $this->mask_offset_x > $this->fill_w
|| $this->mask_h + $this->mask_offset_y > $this->fill_h)
?true:false;
}
/**
* 检查水印图是否超过原图
*/
function _checkMaskValid()
{
if( $this->mask_w + $this->mask_offset_x > $this->src_w
|| $this->mask_h + $this->mask_offset_y > $this->src_h)
{
die("水印图片尺寸大于原图,请缩小水印图");
}
}
/**
* 取得图片类型
*
* @param string $file_path 文件路径
*/
function _getImgType($file_path)
{
$type_list = array("1"=>"gif","2"=>"jpg","3"=>"png","4"=>"swf","5" => "psd","6"=>"bmp","15"=>"wbmp");
if(file_exists($file_path))
{
$img_info = @getimagesize ($file_path);
if(isset($type_list[$img_info[2]]))
{
Return $type_list[$img_info[2]];
}
}
else
{
die("文件不存在,不能取得文件类型!");
}
}
/**
* 检查图片类型是否合法,调用了array_key_exists函数,此函数要求
* php版本大于4.1.0
*
* @param string $img_type 文件类型
*/
function _checkValid($img_type)
{
if(!array_key_exists($img_type, $this->all_type))
{
Return false;
}
}
/**
* 按指定路径生成目录
*
* @param string $path 路径
*/
function _mkdirs($path)
{
$adir = explode('/',$path);
$dirlist = '';
$rootdir = array_shift($adir);
if(($rootdir!='.'||$rootdir!='..')&&!file_exists($rootdir))
{
@mkdir($rootdir);
}
foreach($adir as $key=>$val)
{
if($val!='.'&&$val!='..')
{
$dirlist .= "/".$val;
$dirpath = $rootdir.$dirlist;
if(!file_exists($dirpath))
{
@mkdir($dirpath);
@chmod($dirpath,0777);
}
}
}
}
/**
* 垂直翻转
*
* @param string $src 图片源
*/
function _flipV($src)
{
$src_x = $this->getImgWidth($src);
$src_y = $this->getImgHeight($src);
$new_im = imagecreatetruecolor($src_x, $src_y);
for ($y = 0; $y < $src_y; $y++)
{
imagecopy($new_im, $src, 0, $src_y - $y - 1, 0, $y, $src_x, 1);
}
$this->h_src = $new_im;
}
/**
* 水平翻转
*
* @param string $src 图片源
*/
function _flipH($src)
{
$src_x = $this->getImgWidth($src);
$src_y = $this->getImgHeight($src);
$new_im = imagecreatetruecolor($src_x, $src_y);
for ($x = 0; $x < $src_x; $x++)
{
imagecopy($new_im, $src, $src_x - $x - 1, 0, $x, 0, 1, $src_y);
}
$this->h_src = $new_im;
}
}
?>
下面来看使用方法:
require_once('lib/ImageHandler.phpcls');
$imgHandler_Obj = new ImageHandler();
/* 默认缩小放大 */
$imgHandler_Obj->setSrcImg("img/xrk.jpg");
$imgHandler_Obj->setDstImg("tmp/New_Image_0.jpg");
$imgHandler_Obj->setCutType(0);
// 指定缩放比例
$imgHandler_Obj->createImg(20);//50 100 200 试试
/* 1, 文字水印图片缩小
$imgHandler_Obj->setSrcImg("img/xrk.jpg");
$imgHandler_Obj->setMaskFont("Fonts/STXINGKA.TTF");
$imgHandler_Obj->setMaskFontSize(15);
$imgHandler_Obj->setMaskFontColor("#0061A7");
$imgHandler_Obj->setMaskTxtPct(20);
$imgHandler_Obj->setDstImgBorder(0,"#dddddd");
$imgHandler_Objext = "Happy漫步者";
//$str = mb_convert_encoding($imgHandler_Objext,"UTF-8","GBK");
$imgHandler_Obj->setMaskWord($imgHandler_Objext);
// 指定固定宽高 输出到浏览器
$imgHandler_Obj->createImg(400,400);
*/
/* 2, 加水印图片缩小
$imgHandler_Obj->setSrcImg("img/test.jpg");
$imgHandler_Obj->setDstImg("tmp/New_Image_2.jpg");
$imgHandler_Obj->setMaskImg("img/t.gif");
$imgHandler_Obj->setMaskPosition(0);//0为在图片右下角加入水印
$imgHandler_Obj->setMaskImgPct(60);
$imgHandler_Obj->setDstImgBorder(1,"#dddddd");
// 指定缩放比例
$imgHandler_Obj->createImg(400,400);
*/
/* 3, 同步缩小
$imgHandler_Obj->setSrcImg("img/test.jpg");
$imgHandler_Obj->setCutType(0);//同步缩小
$imgHandler_Obj->setDstImg("tmp/New_Image_3.jpg");
$imgHandler_Obj->createImg(150,160);
*/
/* 4, 剪裁图片
$imgHandler_Obj->setSrcImg("img/test.jpg");
$imgHandler_Obj->setCutType(2);//指明为手工裁切
$imgHandler_Obj->setSrcCutPosition(50, 50);// 源图起点坐标
$imgHandler_Obj->setRectangleCut(300, 200);// 裁切尺寸
$imgHandler_Obj->setDstImg("tmp/New_Image_4.jpg");
$imgHandler_Obj->createImg(300,200);
*/
<?
/**
* 生成水印,调用了生成水印文字和水印图片两个方法
*/
function _createMask()
{
if($this->mask_word)
{
// 获取字体信息
$this->_setFontInfo();
if($this->_isFull())
{
die("水印文字过大");
}
else
{
$this->h_dst = imagecreatetruecolor($this->dst_w, $this->dst_h);
$white = ImageColorAllocate($this->h_dst,255,255,255);
imagefilledrectangle($this->h_dst,0,0,$this->dst_w,$this->dst_h,$white);// 填充背景色
$this->_drawBorder();
imagecopyresampled( $this->h_dst, $this->h_src,
$this->start_x, $this->start_y,
$this->src_x, $this->src_y,
$this->fill_w, $this->fill_h,
$this->copy_w, $this->copy_h);
$this->_createMaskWord($this->h_dst);
}
}
if($this->mask_img)
{
$this->_loadMaskImg();//加载时,取得宽高
if($this->_isFull())
{
// 将水印生成在原图上再拷
$this->_createMaskImg($this->h_src);
$this->h_dst = imagecreatetruecolor($this->dst_w, $this->dst_h);
$white = ImageColorAllocate($this->h_dst,255,255,255);
imagefilledrectangle($this->h_dst,0,0,$this->dst_w,$this->dst_h,$white);// 填充背景色
$this->_drawBorder();
imagecopyresampled( $this->h_dst, $this->h_src,
$this->start_x, $this->start_y,
$this->src_x, $this->src_y,
$this->fill_w, $this->fill_h,
$this->copy_w, $this->copy_h);
}
else
{
// 创建新图并拷贝
$this->h_dst = imagecreatetruecolor($this->dst_w, $this->dst_h);
$white = ImageColorAllocate($this->h_dst,255,255,255);
imagefilledrectangle($this->h_dst,0,0,$this->dst_w,$this->dst_h,$white);// 填充背景色
$this->_drawBorder();
imagecopyresampled( $this->h_dst, $this->h_src,
$this->start_x, $this->start_y,
$this->src_x, $this->src_y,
$this->fill_w, $this->fill_h,
$this->copy_w, $this->copy_h);
$this->_createMaskImg($this->h_dst);
}
}
if(empty($this->mask_word) && empty($this->mask_img))
{
$this->h_dst = imagecreatetruecolor($this->dst_w, $this->dst_h);
$white = ImageColorAllocate($this->h_dst,255,255,255);
imagefilledrectangle($this->h_dst,0,0,$this->dst_w,$this->dst_h,$white);// 填充背景色
$this->_drawBorder();
imagecopyresampled( $this->h_dst, $this->h_src,
$this->start_x, $this->start_y,
$this->src_x, $this->src_y,
$this->fill_w, $this->fill_h,
$this->copy_w, $this->copy_h);
}
}
/**
* 画边框
*/
function _drawBorder()
{
if(!empty($this->img_border_size))
{
$c = $this->_parseColor($this->img_border_color);
$color = ImageColorAllocate($this->h_src,$c[0], $c[1], $c[2]);
imagefilledrectangle($this->h_dst,0,0,$this->dst_w,$this->dst_h,$color);// 填充背景色
}
}
/**
* 生成水印文字
*/
function _createMaskWord($src)
{
$this->_countMaskPos();
$this->_checkMaskValid();
$c = $this->_parseColor($this->mask_font_color);
$color = imagecolorallocatealpha($src, $c[0], $c[1], $c[2], $this->mask_txt_pct);
if(is_numeric($this->font))
{
imagestring($src,
$this->font,
$this->mask_pos_x, $this->mask_pos_y,
$this->mask_word,
$color);
}
else
{
imagettftext($src,
$this->font_size, 0,
$this->mask_pos_x, $this->mask_pos_y,
$color,
$this->font,
$this->mask_word);
}
}
/**
* 生成水印图
*/
function _createMaskImg($src)
{
$this->_countMaskPos();
$this->_checkMaskValid();
imagecopymerge($src,
$this->h_mask,
$this->mask_pos_x ,$this->mask_pos_y,
0, 0,
$this->mask_w, $this->mask_h,
$this->mask_img_pct);
imagedestroy($this->h_mask);
}
/**
* 加载水印图
*/
function _loadMaskImg()
{
$mask_type = $this->_getImgType($this->mask_img);
$this->_checkValid($mask_type);
// file_get_contents函数要求php版本>4.3.0
$src = '';
if(function_exists("file_get_contents"))
{
$src = file_get_contents($this->mask_img);
}
else
{
$handle = fopen ($this->mask_img, "r");
while (!feof ($handle))
{
$src .= fgets($fd, 4096);
}
fclose ($handle);
}
if(empty($this->mask_img))
{
die("水印图片为空");
}
$this->h_mask = ImageCreateFromString($src);
$this->mask_w = $this->getImgWidth($this->h_mask);
$this->mask_h = $this->getImgHeight($this->h_mask);
}
/**
* 图片输出
*/
function _output()
{
$img_type = $this->img_type;
$func_name = $this->all_type[$img_type]['output'];
if(function_exists($func_name))
{
// 判断浏览器,若是IE就不发送头
if(isset($_SERVER['HTTP_USER_AGENT']))
{
$ua = strtoupper($_SERVER['HTTP_USER_AGENT']);
if(!preg_match('/^.*MSIE.*\)$/i',$ua))
{
header("Content-type:$img_type");
}
}
$func_name($this->h_dst, $this->dst_img, $this->img_display_quality);
}
else
{
Return false;
}
}
/**
* 分析颜色
*
* @param string $color 十六进制颜色
*/
function _parseColor($color)
{
$arr = array();
for($ii=1; $ii<strlen ($color); $ii++)
{
$arr[] = hexdec(substr($color,$ii,2));
$ii++;
}
Return $arr;
}
/**
* 计算出位置坐标
*/
?>
相关文章
- ...2015-12-29
- php语言实现redis的客户端与服务端有一些区别了因为前面介绍过服务端了这里我们来介绍客户端吧,希望文章对各位有帮助。 为了更好的了解redis协议,我们用php来实现...2016-11-25
- 有时我们在页面上需要选择数值范围,如购物时选取价格区间,购买主机时自主选取CPU,内存大小配置等,使用直观的滑块条直接选取想要的数值大小即可,无需手动输入数值,操作简单又方便。HTML首先载入jQuery库文件以及jRange相关...2015-03-15
- 本文实例讲述了JS实现的简洁纵向滑动菜单(滑动门)效果。分享给大家供大家参考,具体如下:这是一款纵向布局的CSS+JavaScript滑动门代码,相当简洁的手法来实现,如果对颜色不满意,你可以试着自己修改CSS代码,这个滑动门将每一...2015-10-21
php无刷新利用iframe实现页面无刷新上传文件(1/2)
利用form表单的target属性和iframe 一、上传文件的一个php教程方法。 该方法接受一个$file参数,该参数为从客户端获取的$_files变量,返回重新命名后的文件名,如果上传失...2016-11-25jQuery+PHP发布的内容进行无刷新分页(Fckeditor)
这篇文章将使用jQuery,并结合PHP,将Fckeditor发布的内容进行分页,并且实现无刷新切换页面。 本文假设你是WEB开发人员,掌握了jQuery和PHP相关知识,并且熟知Fckeditor的配置和使用。...2015-10-23jQuery+slidereveal实现的面板滑动侧边展出效果
我们借助一款jQuery插件:slidereveal.js,可以使用它控制面板左右侧滑出与隐藏等效果,项目地址:https://github.com/nnattawat/slideReveal。如何使用首先在页面中加载jquery库文件和slidereveal.js插件。复制代码 代码如...2015-03-15- 翻板抽奖的实现流程:前端页面提供6个方块,用数字1-6依次表示6个不同的方块,当抽奖者点击6个方块中的某一块时,方块翻转到背面,显示抽奖中奖信息。看似简单的一个操作过程,却包含着WEB技术的很多知识面,所以本文的读者应该熟...2015-10-21
SQLMAP结合Meterpreter实现注入渗透返回shell
sqlmap 是一个自动SQL 射入工具。它是可胜任执行一个广泛的数据库管理系统后端指印, 检索遥远的DBMS 数据库等,下面我们来看一个学习例子。 自己搭建一个PHP+MYSQ...2016-11-25- 复制代码 代码如下: // 第一种写法 $da = date("w"); if( $da == "1" ){ echo "今天是星期一"; }else if( $da == "2" ){ echo "今天是星期二"; }else if( $da == "3" ){ echo "今天是星期三"; }else if( $da == "4"...2013-10-04
- js里面设置DOM节点透明度的函数属性:filter= "alpha(opacity=" + value+ ")"(兼容ie)和opacity=value/100(兼容FF和GG)。 先来看看设置透明度的兼容性代码: 复制代码 代码如下: function setOpacity(ele, opacity) { if (...2014-06-07
- 本文就是和大家分享一款由php结合ajax实现的无刷新留言板,先给大家看一下最后的效果图:数据库连接代码如下: <?php$conn = @mysql_connect("localhost","root","root") or die ("MySql连接错误");mysql_select_db("d...2015-10-30
- 这篇文章主要介绍了基于jquery实现表格无刷新分页,功能实现了前端排序功能,增加了前端搜索功能,感兴趣的小伙伴们可以参考一下...2016-01-08
- 这篇文章主要为大家详细介绍了微信小程序实现选择地址省市区三级联动,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2020-06-21
- 本文我们需要解决的问题是如何实现Http请求来实现通信,解决Android 2.3 版本以后无法使用Http请求问题,下面请看正文。 Android开发中使用HttpClient来开发Http程序...2016-09-20
- 复制代码 代码如下:call PROCEDURE_split('分享,代码,片段',',');select * from splittable;复制代码 代码如下:drop PROCEDURE if exists procedure_split;CREATE PROCEDURE `procedure_split`( inputstring varc...2014-05-31
- 这篇文章主要介绍了基于jquery实现省市区三级联动效果,需要的朋友可以参考下...2015-12-27
- 文字发光效果我们可以直接使用css来实现了今天我们来看一篇关于文字发光效果的例子,希望这篇文章能够帮助到各位朋友哦。 前言 我录制的慕课网视频一直没有上线,慕...2016-09-14
- 基本思想就是:在JS动态创建select控件的option,通过Ajax获取在PHP从SQL数据库获取的省市区信息,代码有点长,但很多都是类似的,例如JS中省、市、区获取方法类似,PHP中通过参数不同执行不同的select语句。index.html代码:复制...2014-05-31
- 下面代码用JS实现了程序的暂停与继续 复制代码 代码如下: <script type="text/javascript"> /*Javascript中暂停功能的实现 Javascript本身没有暂停功能(sleep不能使用)同时 vbscript也不能使用doEvents,故编写此函数实...2013-10-13