我有了这个选择在我的代码,选择一个章节中,我要显示(image here)数量:更新选择值(HTML)的按钮
<select name="select" onchange="javascript:sliders[0].goTo(value);">
<?php for($i=1; $i<$row['nbChapitre']+1; $i++){ ?>
<option value="<?php echo $i; ?>">Chapitre <?php echo $i ;?></option>
<?php } ?>
</select>
当我更新它,它的工作原理完美(滑块移动到问题章节)。 但是,当我使用它有这样的代码按钮(下一个和以前):
<a href="javascript:sliders[0].goToPrev()"> < </a>
<a href="javascript:sliders[0].goToNext()"> > </a>
作品背后的滑块,但选择不更新,我不知道该怎么做.. 。
感谢您的帮助。
编辑:嗯,我觉得我已经给你看我的滑块功能:
var Slider = function() { this.initialize.apply(this, arguments) }
Slider.prototype = {
initialize: function(slider) {
this.ul = slider.children[0]
this.li = this.ul.children
this.ul.style.width = (this.li[0].clientWidth * this.li.length) + 'px'
this.currentIndex = 0
},
goTo: function(index) {
if (index < 0 || index > this.li.length - 1)
return
this.ul.style.left = '-' + (100 * index) + '%'
this.currentIndex = index
},
goToPrev: function() {this.goTo(this.currentIndex - 1)},
goToNext: function() {this.goTo(this.currentIndex + 1)}};
我试着像你说的对它们进行编辑,但没有什么变化......
嗯,我认为我的上一个和下一个功能没有得到我的当前选择的价值,因为当我手动改变我的选择值(为例:第3章) Next函数将不起作用,但Previous函数将用于chapter2,然后下一个函数将再次运行。这很奇怪,我不解释它。 –