嗨,我想使用按钮将图像添加到内容流。当您单击按钮功能将被调用并加载所有图像。这是我的代码。
<link rel='stylesheet' title='Standard' href='contentflow/cfstyles.css' type='text/css' media='screen' />
<script language='JavaScript' type='text/javascript' src='contentflow/contentflow.js'></script>
<script type='text/javascript' src='contentflow/jquery.min.js'></script>` <div style='width:400px;height:200px;' class='maincontent'>
<div id='contentFlow' class='ContentFlow'>
<div class='loadIndicator'><div class='indicator'></div></div>
<div id='adddiv' class='flow'>
//images should come to here
</div>
<div class='globalCaption'></div>
<div class='scrollbar'>
<div class='slider'><div class='position'></div></div>
</div>
</div>
<input type="button" value="Click me!" onclick="start();" />`
<script tyle='text/javascript'>
function start(){
var cf = new ContentFlow('contentFlow', {reflectionColor: '#000000'});
$(document).ready(function() {
for (var i=0; i<15; i++ ){
$("#adddiv").prepend(" <div class='item'><img onclick='start(" + i + ");' class='content' src='contentflow/pics/pic"+i+".png'/><div class='caption'>" + i + "</div></div>");
}
});
}
如果我不使用按钮和功能,它会直接加载所有图像,但如果我想加载带有功能的图像,它就不起作用。这里有什么问题?