This article mainly introduces how to implement Simple tabs and automatic switch effects in javascript. It involves the implementation skills of javascript operation tabs and automatic switch effects, which is of great practical value, for more information about how to implement Simple tabs and automatic switch in js, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:
Next, I will go to the previous article "js achieves simple switchable tab effects" to further implement the switchover effect that can be automatically switched. With this effect, I can make a simple focus chart.
Note:
Set an identifier number to 0, write an identifier + 1 every several seconds, execute the function of switching effect, and then execute.
When the length of the tag exceeds the length of the current tab, set it to 0.
Turn off the timer when you move the mouse to the tab, and turn on the timer when you move the mouse away.
Untitled documentScript window. onload = function () {tab ("tab_t", "li", "tab_c", "p", "onmouseover") function tab (tab_t, tab_t_tag, tab_c, tag_c_tag, evt) {var tab_t = document. getElementById (tab_t); var tab_t_li = tab_t.getElementsByTagName (tab_t_tag); var tab_c = document. getElementById (tab_c); var tab_c_li = tab_c.getElementsByTagName (tag_c_tag); var len = tab_t_li.length; var I = 0; var timer = null; var num = 0; for (I = 0; I
= Len) num = 0; tab_change () ;}, 1000) ;}autoplay () ;}} script
- Select 1
- Select 2
- Select 3
- Select 4
Content 1
Content 2
Content 3
Content 4
I hope this article will help you design javascript programs.