废话不多说我贴代码哈
window.onload = function () {
$.get("index.ashx", function (sText, sTes) {
var dataObj = eval("(" + sText + ")");
$.each(dataObj, function (i, n) {
$("#demo1").prepend("<img src='UploadFile/s" + dataObj[i].PhoPic + " ' title='" + dataObj[i].PhoTitle + "' height:200px width:155px border='0'>");
})
});
}
//上面是jquery从数据库里面读取图片
<style type="text/css">
<!--
#demo {
background: #000000;
overflow:hidden;
border: 1px dashed #CCC;
width: 100%;
height:208px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
margin-top:1px;
}
#demo2 {
float: left;
}
-->
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">
这儿是用jquery加进来的图片
</div>
<div id="demo2"></div></div>
</div>
循环滚动的js
<script type="text/javascript">
<!--
var speed = 20; //数字越大速度越慢
var tab = document.getElementById("demo");
var tab1 = document.getElementById("demo1");
var tab2 = document.getElementById("demo2");
tab2.innerHTML = tab1.innerHTML;
function Marquee() {
if (tab2.offsetWidth - tab.scrollLeft <= 0)
tab.scrollLeft -= tab1.offsetWidth
else {
tab.scrollLeft++;
}
}
var MyMar = setInterval(Marquee, speed);
tab.onmouseover = function () { clearInterval(MyMar) };
tab.onmouseout = function () { MyMar = setInterval(Marquee, speed) };
-->
</script>如果是
<div id="demo1">
<img src="i.jpg"/>
<img src="i.jpg"/>
<img src="i.jpg"/>
<img src="i.jpg"/>
</div>
他会滚动 用$("#demo1").prepend("<img src='UploadFile/s" + dataObj[i].PhoPic + " ' title='" + dataObj[i].PhoTitle + "' height:200px width:155px border='0'>");
加进来的不滚动 朋友们看看有没啥子解决方法谢谢了
window.onload = function () {
$.get("index.ashx", function (sText, sTes) {
var dataObj = eval("(" + sText + ")");
$.each(dataObj, function (i, n) {
$("#demo1").prepend("<img src='UploadFile/s" + dataObj[i].PhoPic + " ' title='" + dataObj[i].PhoTitle + "' height:200px width:155px border='0'>");
})
});
}
//上面是jquery从数据库里面读取图片
<style type="text/css">
<!--
#demo {
background: #000000;
overflow:hidden;
border: 1px dashed #CCC;
width: 100%;
height:208px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
margin-top:1px;
}
#demo2 {
float: left;
}
-->
</style>
<div id="demo">
<div id="indemo">
<div id="demo1">
这儿是用jquery加进来的图片
</div>
<div id="demo2"></div></div>
</div>
循环滚动的js
<script type="text/javascript">
<!--
var speed = 20; //数字越大速度越慢
var tab = document.getElementById("demo");
var tab1 = document.getElementById("demo1");
var tab2 = document.getElementById("demo2");
tab2.innerHTML = tab1.innerHTML;
function Marquee() {
if (tab2.offsetWidth - tab.scrollLeft <= 0)
tab.scrollLeft -= tab1.offsetWidth
else {
tab.scrollLeft++;
}
}
var MyMar = setInterval(Marquee, speed);
tab.onmouseover = function () { clearInterval(MyMar) };
tab.onmouseout = function () { MyMar = setInterval(Marquee, speed) };
-->
</script>如果是
<div id="demo1">
<img src="i.jpg"/>
<img src="i.jpg"/>
<img src="i.jpg"/>
<img src="i.jpg"/>
</div>
他会滚动 用$("#demo1").prepend("<img src='UploadFile/s" + dataObj[i].PhoPic + " ' title='" + dataObj[i].PhoTitle + "' height:200px width:155px border='0'>");
加进来的不滚动 朋友们看看有没啥子解决方法谢谢了
解决方案 »
- jquery easyui 的tree 控件如何 建立点击事件?
- 有什么办法能屏蔽flash的页面跳转吗?
- js或jquery 可以做到这些吗?
- 关于jquery的ajaxfileupload的控件刷新问题
- 在Firefox中,select标签的 onkeypress 句柄,为何无法停止按键功能生效?『有简单例子,请各位花几秒钟看一下.』
- 全选Check box的问题~~~~~急急急
- 这个功能改怎么实现?
- $.ajax
- 还是这个问题,难道纯用客户端的技术解决不了吗?在线讨论,急!!!
- 两个js文件方法调用问题
- extjs gridpanenl 行(列)的计算(求助)
- jquery怎么读取这样的json数据
$.get("index.ashx", function (sText, sTes) {
var dataObj = eval("(" + sText + ")");
var insertStr="";
$.each(dataObj, function (i, n) {
insertStr+="<img src='UploadFile/s" + dataObj[i].PhoPic + " ' title='" + dataObj[i].PhoTitle + "' height:200px width:155px border='0'>";
}
$("#demo1").html(insertStr);)
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Alpha.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<mce:script type="text/javascript" src="extjs/adapter/jquery/jquery.js" mce_src="extjs/adapter/jquery/jquery.js"></mce:script>
<mce:script type="text/javascript">
<!--
var ary = ["red", "blue", "#CCFFFF", "#99FFCC"];
var imgAry = new Array();
imgAry.push("http://hiphotos.baidu.com/%BA%EC%C2%A5%C7%E9%C3%CE/pic/item/ed9e7094af4f2677d1135e93.jpg");
imgAry.push("http://hiphotos.baidu.com/%BA%EC%C2%A5%C7%E9%C3%CE/pic/item/cf4013658b43f3ccf7365493.jpg");
imgAry.push("http://hiphotos.baidu.com/%BA%EC%C2%A5%C7%E9%C3%CE/pic/item/2f78156fb7c8dae681cb4a93.jpg");
imgAry.push("http://hiphotos.baidu.com/%BA%EC%C2%A5%C7%E9%C3%CE/pic/item/ed9e7094af1f2677d0135e23.jpg");
var i = 0;
$(function () {
$("div").css("width", "300px").css("height", "200px").css("border", "1px solid red");
$("img").css("width", "200px").css("height", "200px")
.css("filter", "progid:DXImageTransform.Microsoft.Alpha(startX=0, startY=0, finishX=100, finishY=100,style=3,opacity=0,finishOpacity=100)");
/*
调节style=3,opacity=0,finishOpacity=100这三个值改变效果,
style 渐变样式 0,1,2,3
opacity开始透明度 0 25 50 75 100
finishOpacity结束透明读0 25 50 75 100
*/
show();
});
function show () {
$("div").css("background-color", ary[i]);
$("img").attr("src", imgAry[i]);
i++;
if (i > ary.length - 1) {
i = 0;
}
setTimeout("show()", "1000");
}
// -->
</mce:script>
</head>
<body>
<div>
<img src="http://hiphotos.baidu.com/%BA%EC%C2%A5%C7%E9%C3%CE/pic/item/cf4013658b43f3ccf7365493.jpg" mce_src="http://hiphotos.baidu.com/%BA%EC%C2%A5%C7%E9%C3%CE/pic/item/cf4013658b43f3ccf7365493.jpg"/>
</div>
</body>
</html>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/IBM_hoojo/archive/2010/06/08/5655506.aspx
$.get("index.ashx", function (sText, sTes) {
var dataObj = eval("(" + sText + ")");
var insertStr="";
$.each(dataObj, function (i, n) {
insertStr+="<img src='UploadFile/s" + dataObj[i].PhoPic + " ' title='" + dataObj[i].PhoTitle + "' height:200px width:155px border='0'>";
}
$("#demo1").html(insertStr);)
});一楼这个不行呀