0
我想要一個從跨度讀取圖像名稱的圖像滑塊。我的代碼有什麼問題?即使警報命令沒有執行。如何解決這個問題?從跨度讀取圖像文件名
<html><head>
<title></title>
<script src="Default.aspx_files/jquery-1.js" type="text/x-jquery-tmpl"></script>
<script src="Default.aspx_files/General.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
jQuery(function() {
var i = 0;
var banner = $('.imagesContainer span').map(function() {
return $.trim($(this).text())
}).get();
function fun() {
//How to init array here from inner text of spans?
i++;
if (i == banner.length) {
i = 0;
}
$('#img1').attr('src', '/slide/' + banner[i]);
alert('/slide/' + banner[i]);
}
setInterval(fun, 1000);
})
</script>
</head>
<body>
<form method="post" action="Default.aspx" id="form1">
<div class="imagesContainer">
<span>
73defe4b-9819-4e12-b351-3813686e0c83.gif
</span>
<span>
4c2ed116-500d-42ad-8aa5-983bf214d5d3.png
</span>
</div>
</form>
</body></html>
它顯示警報,檢查它在這裏,http://jsfiddle.net/rajaadil/Ed7BU/1/ – Adil
它似乎工作,檢查在這裏:http://jsfiddle.net/hbrunar/4xBXf/1/ – Vickel