可以用無縫圖片滾動效果 如:
綦江ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
!DOCTYPE html
html
head
meta charset="utf-8"
title/title
style
* { margin: 0; padding: 0;}
body{ background-color:#1B1B1B}
#div1{ width: 800px; height: 150px; position: relative; margin: 100px auto;overflow: hidden;}
#div1 ul { width: 800px; height: 150px; position: relative; }
#div1 ul li { height: 150px; float: left; list-style: none; padding-right:20px;}
#div1 ul li img { width: 200px; height: 150px; display: inline-block;}
a{ color: #B4B4B4; }
/style
script type="text/javascript"
window.onload=function(){
var odiv = document.getElementById('div1');
var oul = odiv.getElementsByTagName('ul')[0];
var ali = oul.getElementsByTagName('li');
var spa = -2;
oul.innerHTML=oul.innerHTML+oul.innerHTML;
oul.style.width=ali[0].offsetWidth*ali.length+'px';
function move(){
if(oul.offsetLeft-oul.offsetWidth/2){
oul.style.left='0';
}
if(oul.offsetLeft0){
oul.style.left=-oul.offsetWidth/2+'px'
}
oul.style.left=oul.offsetLeft+spa+'px';
}
var timer = setInterval(move,30)
odiv.onmousemove=function(){clearInterval(timer);}
odiv.onmouseout=function(){timer = setInterval(move,30)};
document.getElementsByTagName('a')[0].onclick = function(){
spa=-2;
}
document.getElementsByTagName('a')[1].onclick = function(){
spa=2;
}
}
/script
/head
body
a href="#" style=" display: block; margin:0 auto; width: 50px;"向左走/a
a href="#" style=" display: block; margin:0 auto; width: 50px;"向右走/a
div id="div1"
ul
liimg src="img/1.jpg"http://li
liimg src="img/2.jpg"http://li
liimg src="img/3.jpg"http://li
liimg src="img/4.jpg"http://li
/ul
/div
/body
/html
一般不向數(shù)據(jù)庫插入圖片 而是插入圖片的src 通過src找到圖片然后顯示。
?php
session_start();
//array數(shù)組中放圖片的格式
$uptypes = array("image/jpg","image/jpeg","image/png","image/pjpeg","image/gif","image/bmp","image/x-png");
$files =$_FILES["uppic"];
if($files["size"]2097152){ //圖片大小判斷
echo "上傳圖片不能大于2M";
echo "meta http-equiv='REFRESH' CONTENT='1;URL=pic.php'";
exit;
}
$ftype =$files["type"];
if(!in_array($ftype,$uptypes)){ //圖片格式判斷
echo "上傳的圖片文件格式不正確";
echo "meta http-equiv='REFRESH' CONTENT='1;URL=pic.php'";
}
$fname = $files["tmp_name"]; //在服務(wù)器臨時存儲名稱
$image_info = getimagesize($fname);
$name = $files["name"];
$str_name = pathinfo($name); //以數(shù)組的形式返回文件路勁的信息
$extname = strtolower($str_name["extension"]); //把字符串改為小寫 extensiorn擴(kuò)展名
$upload_dir = "upload/"; //upload文件夾
$file_name = date("YmdHis").rand(1000,9999).".".$extname;
$str_file = $upload_dir.$file_name; //文件目錄
//存入數(shù)據(jù)庫
$con=mysql_connect("localhost","root","");
if(!$con){
die(("數(shù)據(jù)庫連接失敗").mysql_error());
}
mysql_select_db("mywork",$con);
$sql="update user set picpath='$str_file' where user_name='$username'"; //將圖片地址插入數(shù)據(jù)庫mywork
mysql_query($sql,$con);
mysql_close($con);
if(!file_exists($upload_dir)){
mkdir($upload_dir); //創(chuàng)建目錄 成功則返回true 失敗則返回flase
}
if(!move_uploaded_file($files["tmp_name"],$str_file)){ //將上傳的文件移動到新的目錄 要移動文件和文件新目錄 成功則返回true
echo "圖片上傳失敗";
echo "meta http-equiv='REFRESH' CONTENT='1;URL=插入失敗后希望跳轉(zhuǎn)的頁面";
}
else{
//echo "img src=".$str_file."";
echo "圖片上傳成功";
echo "meta http-equiv='REFRESH' CONTENT='1;URL=插入成功希望挑戰(zhàn)的頁面";
}
一般不向數(shù)據(jù)庫插入圖片 而是插入圖片的src 通過src找到圖片然后顯示。
?php
session_start();
//array數(shù)組中放圖片的格式
$uptypes = array("image/jpg","image/jpeg","image/png","image/pjpeg","image/gif","image/bmp","image/x-png");
$files =$_FILES["uppic"];
if($files["size"]2097152){ //圖片大小判斷
echo "上傳圖片不能大于2M";
echo "";
exit;
}
$ftype =$files["type"];
if(!in_array($ftype,$uptypes)){ //圖片格式判斷
echo "上傳的圖片文件格式不正確";
echo "";
}
$fname = $files["tmp_name"]; //在服務(wù)器臨時存儲名稱
$image_info = getimagesize($fname);
$name = $files["name"];
$str_name = pathinfo($name); //以數(shù)組的形式返回文件路勁的信息
$extname = strtolower($str_name["extension"]); //把字符串改為小寫 extensiorn擴(kuò)展名
$upload_dir = "upload/"; //upload文件夾
$file_name = date("YmdHis").rand(1000,9999).".".$extname;
$str_file = $upload_dir.$file_name; //文件目錄
//存入數(shù)據(jù)庫
$con=mysql_connect("localhost","root","");
if(!$con){
die(("數(shù)據(jù)庫連接失敗").mysql_error());
}
mysql_select_db("mywork",$con);
$sql="update user set picpath='$str_file' where user_name='$username'"; //將圖片地址插入數(shù)據(jù)庫mywork
mysql_query($sql,$con);
mysql_close($con);
if(!file_exists($upload_dir)){
mkdir($upload_dir); //創(chuàng)建目錄 成功則返回true 失敗則返回flase
}
if(!move_uploaded_file($files["tmp_name"],$str_file)){ //將上傳的文件移動到新的目錄 要移動文件和文件新目錄 成功則返回true
echo "圖片上傳失敗";
echo "