我想通过代码在我的 ul 标签中动态添加图表控件。我怎样才能做到这一点?这是我对anythingslider javascript 的声明
<script type="text/javascript">
var slider2 = ['Machines', 'Trend','test','test2','test3'];
function formatText(index, panel) {
return slider2[index - 1];
}
$(function () {
$('#slider2').anythingSlider({
width: 800, // if resizeContent is false, this is the default width if panel size is not defined
height: 400, // if resizeContent is false, this is the default height if panel size is not defined
buildArrows: true,
resizeContents: false, // If true, solitary images/objects in the panel will expand to fit the viewport
autoPlay: true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
navigationFormatter: formatText, // Format navigation labels with text
forwardText: "»",
backText: "«"
})
});
</script>
编辑:这是带有新添加代码的页面的源代码:
<ul id="MainContent_slider2">
<img id="MainContent_PlantMachineChart" src="/ChartImg.axd?i=chart_93717cef16e84387b35d83bdd04da217_0.png&g=898a170672b0476ca6f6d49173c231b1" alt="" usemap="#MainContent_PlantMachineChartImageMap" style="height:400px;width:868px;border-width:0px;" />
<map name="MainContent_PlantMachineChartImageMap" id="MainContent_PlantMachineChartImageMap">
</map>
<li><img id="MainContent_ctl01" src="/ChartImg.axd? i=chart_93717cef16e84387b35d83bdd04da217_1.png&g=23020f9898ab40898782de3234fae6e4" alt="" style="height:400px;width:868px;border-width:0px;" /></li'><li'><img id="MainContent_ctl03" src="/ChartImg.axd? i=chart_93717cef16e84387b35d83bdd04da217_2.png&g=aa749f6279484859a7892f1f117fbd1c" alt="" style="height:400px;width:868px;border-width:0px;" /></li></ul>
它列出了第一个图表(我在这里省略)的所有数据点,这些数据点不是动态添加的。