The <script>//function cannot have the same name,--The child function//is defined function------------------AutoTab (ID) {tab.apply (this, argumen TS); This.timer = null; This.inits (); This.autoplay ();} Autotab.prototype = new Tab (); AutoTab.prototype.constructor = autotab;//Initialization AutoTab.prototype.inits = function () {this.play (); This.over (); This.out ();};/ /AutoPlay AutoTab.prototype.play = function () {var _this = this; This.timer = setinterval (function () {_this.inow++; if (_this.inow==_this.abtn.length) {_this.inow = 0; } _this.tab (); },1000);};/ /Stop AutoTab.prototype.stop = function () {clearinterval (this.timer);};/ /mouse over AutoTab.prototype.over = function () {var _this = this; This.oBox.onmouseover = function () {_this.stop (); };};/ /mouse Away AutoTab.prototype.out = function () {var _this = this; This.oBox.onmouseout = function () {_this.play (); };}; Window.onload=function () {New Tab (' tab1 '); New AutoTab (' tab2 ');}; </script>
JS based on object-oriented Carousel diagram 2