empirecmsmorepic.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //showsmallpics
  2. function yecmsShowSmallPics(){
  3. var str='';
  4. var selectpages='';
  5. var listpages='';
  6. var i;
  7. var cname='';
  8. var lname='';
  9. var sname='';
  10. for(i=0;i<ecmspicnum;i++)
  11. {
  12. cname='';
  13. lname='';
  14. sname='';
  15. if(i==0)
  16. {
  17. cname=' class="espiccss"';
  18. lname=' class="epiclpcss"';
  19. sname=' selected';
  20. }
  21. str+='<td bgcolor="#cccccc" align="center" id="espicid'+i+'"'+cname+'><a href="#empirecms" onclick="ecmsShowPic('+i+');"><img src="'+ecmspicr[i][0]+'" width="'+epicswidth+'" height="'+epicsheight+'" border="0"></a><br>'+(i+1)+'/'+ecmspicnum+'</td>';
  22. selectpages+='<option value="'+i+'"'+sname+'>第 '+(i+1)+' 页</option>';
  23. listpages+='<a href="#empirecms" id="epiclpid'+i+'" onclick="ecmsShowPic('+i+');"'+lname+'>'+(i+1)+'</a> ';
  24. }
  25. if(eopensmallpics==1)
  26. {
  27. document.getElementById("ecmssmallpicsid").innerHTML='<table><tr>'+str+'</tr></table>';
  28. }
  29. if(eopenselectpage==1)
  30. {
  31. document.getElementById("ecmsselectpagesid").innerHTML='<select name="tothepicpage" id="tothepicpage" onchange="ecmsShowPic(this.options[this.selectedIndex].value);">'+selectpages+'</select>';
  32. }
  33. if(eopenlistpage==1)
  34. {
  35. document.getElementById("ecmslistpagesid").innerHTML=listpages;
  36. }
  37. document.getElementById("ethispage").value=0;
  38. }
  39. //showpic
  40. function ecmsShowPic(page){
  41. var thispage=document.getElementById("ethispage").value;
  42. var sdivwidth=document.getElementById("ecmssmallpicsid").offsetWidth;
  43. if(document.getElementById("ecmssmallpicid")!=null)
  44. {
  45. document.getElementById("ecmssmallpicid").src=ecmspicr[page][0];
  46. }
  47. document.getElementById("ecmsbigpicid").src=ecmspicr[page][1];
  48. if(document.getElementById("ecmspicnameid")!=null)
  49. {
  50. document.getElementById("ecmspicnameid").innerHTML=ecmspicr[page][2];
  51. }
  52. //document.getElementById("ecmssmallpicsid").scrollLeft+=120;
  53. if(page>thispage)
  54. {
  55. if(epicswidth*(page+1)>sdivwidth-epicswidth)
  56. {
  57. document.getElementById("ecmssmallpicsid").scrollLeft+=epicswidth;
  58. }
  59. }
  60. else
  61. {
  62. if(epicswidth*(page-1)<document.getElementById("ecmssmallpicsid").scrollLeft)
  63. {
  64. document.getElementById("ecmssmallpicsid").scrollLeft-=epicswidth;
  65. }
  66. }
  67. document.getElementById("ethispage").value=page;
  68. if(eopensmallpics==1)
  69. {
  70. document.getElementById("espicid"+page).className='espiccss';
  71. document.getElementById("espicid"+thispage).className='';
  72. }
  73. if(eopenlistpage==1)
  74. {
  75. document.getElementById("epiclpid"+page).className='epiclpcss';
  76. document.getElementById("epiclpid"+thispage).className='';
  77. }
  78. if(eopenselectpage==1)
  79. {
  80. document.getElementById("tothepicpage").options[page].selected=true;
  81. }
  82. }
  83. //shownextpic
  84. function ecmsShowNextPic(){
  85. var thispage=parseInt(document.getElementById("ethispage").value);
  86. if(thispage+1>=ecmspicnum)
  87. {
  88. return false;
  89. }
  90. ecmsShowPic(thispage+1);
  91. }
  92. //showprepic
  93. function ecmsShowPrePic(){
  94. var thispage=parseInt(document.getElementById("ethispage").value);
  95. if(thispage<=0)
  96. {
  97. return false;
  98. }
  99. ecmsShowPic(thispage-1);
  100. }
  101. //showtruepic
  102. function ecmsShowTruePic(){
  103. var thispage=parseInt(document.getElementById("ethispage").value);
  104. window.open(ecmspicr[thispage][1]);
  105. }
  106. //movespic
  107. function ecmsMoveSmallPics(scrollwidth){
  108. document.getElementById("ecmssmallpicsid").scrollLeft+=scrollwidth;
  109. }
  110. //autoshowpic
  111. function ecmsPicAutoPlay(){
  112. var sec=parseInt(document.getElementById("autoplaysec").value);
  113. var i;
  114. for(i=1;i<=sec;i++)
  115. {
  116. if(document.getElementById("autoplaystop").value==0)
  117. {
  118. window.setTimeout("ecmsPicAutoPlayDo("+i+","+sec+")",i*1000);
  119. }
  120. else
  121. {
  122. break;
  123. }
  124. }
  125. }
  126. function ecmsPicAutoPlayDo(num,sec){
  127. var t;
  128. if(document.getElementById("autoplaystop").value==1)
  129. {
  130. return "";
  131. }
  132. if(num==sec)
  133. {
  134. t=ecmsShowNextPic();
  135. if(t==false)
  136. {
  137. ecmsShowPic(0);
  138. }
  139. ecmsPicAutoPlay();
  140. }
  141. }
  142. document.onkeydown=function(event){
  143. var e = event || window.event || arguments.callee.caller.arguments[0];
  144. if(e && e.keyCode==37)
  145. {
  146. ecmsShowPrePic();
  147. }
  148. if(e && e.keyCode==39)
  149. {
  150. ecmsShowNextPic();
  151. }
  152. };