SoFunction
Updated on 2025-02-28

Simple and universal JS sliding door code

Copy the codeThe code is as follows:

<UL id=tabMainNav>
<LI class=selected id=tab_GameinfoNav onmousemove="show_tab(0)"><SPAN><A id=tab_1 href="#">{$PHPCMS[sitename]}</A></SPAN></LI>
<LI id=tab_ShareEmailNav onmousemove="show_tab(1)"><SPAN><A id=tab_2 href="#">Share by Email</A></SPAN> </LI>
<LI id=tab_ShareIMNav onmousemove="show_tab(2)"><SPAN><A id=tab_3 href="#">Share by IM</A></SPAN> </LI>
<LI id=tab_BlogNav onmousemove="show_tab(3)"><SPAN><A id=tab_4 href="#">Posted to blog/website</A></SPAN> </LI>
</UL>
<UL ID=''tabContent''>
<LI></LI>
<LI></LI>
<LI></LI>
<LI></LI>
</UL>
 
JS Code
Copy the codeThe code is as follows:

<script language="javascript">
function show_tab(id){
var tabMainNav;
var tabContent;
tabMainNav=('tabMainNav');
tabContent=('tabContent');
for(i=0;i<;i++){
if(i==id){
[i].className='selected';
[i].className='';
}else{
[i].className='';
[i].className='hidden';
}
}
}
</script>

CSS code, modify these two CSS to display different styles
.hidden{
}
.selected{
}