也曾年轻《国学典籍(2):弟子规 & 声律启蒙》
<meta charset="utf-8"><meta name="referrer" content="never" />
<style>
:root {--w:640px;}
#oBlk {
position:relative;width:var(--w);margin:16px auto;background-color:hsl(66, 20%, 80%);
box-shadow:4px 4px 10px black;text-align:center;
img {width:100%}
#ctrlBox {
width:80%;font-size:2em;color:skyblue;position:absolute;left:10%;
text-align:center;
button {cursor:pointer}
#selIdx {width:48px;text-align:right;border:none;font-weight:600;}
}
}
</style>
<div id="oBlk">
<select id="setIdx" >
<option value='pic_dzg'>弟子规</option>
<option value='pic_slqm'>声律启蒙</option>
</select>
<img src="" id="contImg"/>
<div id="ctrlBox">
<button id="backward">⇦ 上一首</button> 
<input id='selIdx' min='0' value='0' disabled/> 
<button id="forward">下一首 ⇨</button>
</div>
</div>
<audio src="https://cccimg.com/view.php/92ffa9460e7b205ef763933d768bbad3.mp3" loop autoplay ></audio>
<script type="module">
import { pic_dzg, pic_slqm } from 'https://644507.freep.cn/644507/script/国学典籍.js';
let poemIdx = 0, poems = pic_dzg;
contImg.src = poems;
//const moduleUrl = 'https://644507.freep.cn/644507/script/国学典籍.js';
function loadData(val) {
switch (val) {
case 'pic_qzw':
poems = pic_qzw;
break;
case 'pic_dzg':
poems = pic_dzg;
break;
case 'pic_zgxw':
poems = pic_zgxw;
break;
case 'pic_slqm':
poems = pic_slqm;
break;
}
poemIdx = 0;
contImg.src = poems;
}
selIdx.max = poems.lenght;
setIdx.onchange = () => {
loadData(setIdx.value);
}
backward.onclick = () => {
poemIdx--; if(poemIdx < 0) poemIdx = poems.length - 1;
contImg.src = poems;
selIdx.value= poemIdx;
}
forward.onclick = () => {
poemIdx++; poemIdx %= poems.length;
contImg.src = poems;
selIdx.value= poemIdx;
}
contImg.onmousedown = (e) => {
if(e.button == 0) forward.click();
else if(e.button == 2) backward.click();
}
oBlk.addEventListener('contextmenu', function(event) {
event.preventDefault();
});
</script>
不知什么原因,该贴我这儿只能看到一根细条
页:
[1]