當前位置:首頁 » 操作系統 » 滾動資料庫

滾動資料庫

發布時間: 2022-05-05 02:30:57

php如何讓資料庫中的圖片在網頁首頁滾動顯示

可以用無縫圖片滾動效果 如:

<!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.offsetLeft>0){

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>

<li><img src="img/1.jpg"/></li>

<li><img src="img/2.jpg"/></li>

<li><img src="img/3.jpg"/></li>

<li><img src="img/4.jpg"/></li>

</ul>

</div>

</body>

</html>

㈡ 從資料庫提取的圖片怎樣滾動

我覺得一般用JS和TABLE對圖片滾動會有好一點的效果。
我先將取出的圖片路徑放在了頁面的隱藏域中,並且用「,」分隔,然後再通過JS對其進行拆分和CSS樣式讓其滾動,具體代碼如下:
後台在Page_Load的時候先從資料庫中取圖片:
protected void Page_Load(object sender, EventArgs e)
{
Hidden2.Value = "";
LoginBLL log = new LoginBLL();
DataSet ds = log.GetImage("1");//獲取圖片信息
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Hidden2.Value += ds.Tables[0].Rows[i]["Image"].ToString() + ","; }
}
}

//前台頁面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Web_Index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>圖片滾動</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
.scroll_div {width:920px;margin-top:0px;margin-right: 10px;margin-left: 10px; overflow: hidden; white-space: nowrap;height:65px;padding:10px;}
.scroll_div img {width:101px;height:65px;border: 0;margin: auto 8px; border:1px #efefef solid;}
#scroll_begin, #scroll_end, #scroll_begin ul, #scroll_end ul, #scroll_begin ul li, #scroll_end ul li{display:inline;}/*設置ul和li橫排*/
</style>
<script language="javascript">
//滾動圖片JS
function ScrollImgLeft(){
var speed=20
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
scroll_div.scrollLeft-=scroll_begin.offsetWidth
else
scroll_div.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
scroll_div.onmouseover=function() {clearInterval(MyMar)}
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}
</script>
</head>
<body>
<div style="text-align:center;">
<div>
<!--#####滾動區域#####-->
<div style="width:968px;margin-left:5px;float:left;">
<div id="scroll_div" class="scroll_div">
<div id="scroll_begin">
<input id="Hidden2" type="hidden" runat="server" />
<ul><script type="text/javascript">
<!--
var str=document.getElementById("Hidden2").value.split(',');
if(str!="")
{
if(str.length-1<10)
{
var a=parseInt(10/(str.length-1));
for(var j=0;j<a+1;j++)
{
for(var i=0;i<str.length-1;i++)
{
document.write('<li><a href='+str[i]+' target="_blank"><span style="color:#E8E9EB;" ><img src="'+str[i]+'" style="border:0px;width:97px;height:61px;"/></span></a></li> ');
}
}
}
else
{

for(var i=0;i<str.length-1;i++)
{
document.write('<li><a href='+str[i]+' target="_blank" ><span style="color:#E8E9EB;"><img src="'+str[i]+'" style="border:0px;width:97px;height:61px;"/></span></a></li> ');
}
}
}
-->
</script>
</ul>
</div> <div id="scroll_end"></div>

</div></div>
</div>
<script type="text/javascript">ScrollImgLeft();</script>
</div>
</body>
</html>
PS:這個圖片滾動如果圖片過少,滾動的時候會出現停頓,因此我對圖片的數量進行了判斷,如若少於十張,會讓它按照余數多添加幾次跟著滾動。

㈢ 滾動公告,橫向滾動資料庫中的一條數據,如何實現,sql資料庫。(asp.net,VB語言)

把資料庫中的數據一次查詢出來。然後頁面中使用JS控制滾動和每次展現的條數。

㈣ PHP網站 中通過資料庫調出圖片和文字 怎樣實現上下滾動效果

上下滾動的效果屬於瀏覽器端的效果了。PHP是實現不了的。需要用javascript來實現。如果你想要學的話,可以找個jquery的教程。jquery屬於javascript的一個框架(就好像Thinkphp對於PHP一樣)。jquery還是比較簡單容易上手的。很多動畫效果都有現成的函數。直接填入參數就可以了

㈤ 怎樣實現ASP滾動顯示資料庫中的記錄

你是要怎麼滾動,自左向右,還是自上而下?給一個自左向右的。

'連接資料庫字元串省去..
'下面是顯示代碼
<div>
<marquee>
<%dim rssql
set rssql=server.createboject("adodb.recordset")
rssql.open "sql名",conn,1,1
do while not rssql.eof
response.write""&rssql("欄位名")&""
rssql.movenext
loop
%>
</marquee>
</div>
<%rssql.close
set rssql=nothing%>

這應該是最簡單的滾動了。。

㈥ .net 圖片滾動連接資料庫問題!

試試這個圖片輪播

有12345數字一起切換

有小圖大圖一起切換

裡面有教程和源碼

㈦ sqlserver 資料庫界面的滾動條怎麼設置

css屬性 overflow-y:auto; DIV裡面的內容超過DIV的高度,右邊就會自動出現滾動條

1、用一個div,定製成圖中的寬度和高度
2、然後再把div的樣式設成overflow-y:scroll,當div里的文字超出那個高度的時候,滾動條就出來了。
例如:<div style="width:100px; height:100px; overflow:auto; border:1px solid #000000;"><img src="" style="width:300px; height:300px;"></div>

㈧ 急!急!如何調用資料庫里的動態圖片,並且讓它滾動,在線等

代碼接上: (這是我另外個號)
<table width="536" border="0" class="table3">
<%
if rs.eof or rs.bof then
response.write("<BR> ??¨¤¨¤?àe?Y?T?á???à??ê???2¨|???????¨¤¨¤?àe<BR>") else
rs.pagesize=12 %>
<tr>
<% rs.AbsolutePage=pagecount for i=1 to rs.recordcount if rs.EOF then exit for %>
<td align="center" class="line"><table width="100" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><table width="104" cellpadding="0" cellspacing="0" bgcolor="#221E1F">
<tr>
<td height="88" align="center" valign="bottom"><a href="proct_list.asp?ProID=<%=rs("p_id")%>"><img src="<%=rs("p_pic")%>" width="120" height="120" border="0" alt="<%=rs("p_name")%>"></a></td>
</tr>
</table></td>
</tr>
</table></td>
<% if i mod 12 = 0 then %>
</tr>
<tr>
<%end if%>
<%
rs.movenext
if i>=rs.pagesize then exit for
next
end if
%>
</table></td>
</tr>
</table>
<%
rs.close
set rs=nothing
%>
</TD>
</TR>
</TABLE>
</center>
</div>
</BODY>
裡面的連接被調用的conn.asp頁面就不貼出來了。
達人們,幫幫小弟吧。在線等,小弟分也不多,解決問題後,利馬就給分。大家最好貼到DM里去看。

㈨ 怎麼實現從資料庫取出的數據在頁面上顯示為超鏈接並由下向上滾動

while (dr1.Read()) { showMsg1 += dr1["cname"].ToString() +" "; showMsgurl1 += dr1["curl"].ToString(); /*+":" + dr["curl"].ToString() + " ";*/ noticeNum++; Response.Write("<a href="+showMsgurl1+">"+showMsg1+"</a>") } noticeNum--; conn.Close(); 試一下

希望採納

熱點內容
文件夾兩孔 發布:2024-10-06 23:48:53 瀏覽:351
ftp工具分析 發布:2024-10-06 23:48:51 瀏覽:157
伺服器被游戲封機器碼怎麼辦 發布:2024-10-06 23:46:10 瀏覽:160
股票java 發布:2024-10-06 23:38:46 瀏覽:290
安卓演算法 發布:2024-10-06 23:14:20 瀏覽:183
域名訪問404 發布:2024-10-06 23:08:52 瀏覽:708
訪問筆錄模版 發布:2024-10-06 22:36:54 瀏覽:140
多用途編程 發布:2024-10-06 22:35:58 瀏覽:618
msde2000資料庫下載 發布:2024-10-06 22:33:35 瀏覽:44
什麼配置可以算神機 發布:2024-10-06 21:52:09 瀏覽:423