Javascript 页面加载时的选框停止和开始按钮
我在页面上有一个选框(滚动页面),当你开始页面时它会直接旋转。但我希望它在我按下按钮时滚动,所以不要直接滚动。它与音频文件(歌曲文本)相对应。我需要添加什么来停止直接在输入页面上滚动文本 这是字幕:Javascript 页面加载时的选框停止和开始按钮,javascript,html,cordova,marquee,Javascript,Html,Cordova,Marquee,我在页面上有一个选框(滚动页面),当你开始页面时它会直接旋转。但我希望它在我按下按钮时滚动,所以不要直接滚动。它与音频文件(歌曲文本)相对应。我需要添加什么来停止直接在输入页面上滚动文本 这是字幕: <marquee behavior="scroll" height="100%" vspace="0%" direction="up" id="mymarquee" scrollamount="0" scolldelay="1000" loop="1"> SONG TEXT GOES H
<marquee behavior="scroll" height="100%" vspace="0%" direction="up" id="mymarquee" scrollamount="0" scolldelay="1000" loop="1"> SONG TEXT GOES HERE </marquee>
歌曲文本在此显示
这些是我想连接到上面脚本的按钮,带有音频功能,这样当你进入页面时字幕不会滚动,当你按下播放按钮时开始滚动,当你再次点击按钮时暂停等等
<div id=audioplay>
<div id="HTML5Audio"><audio id="myaudio"></audio>
<input id="audiofile" type="text" value="" style="display: none;"/>
<img id="off" src="images/general/sound-off.png" width="40" height="32" onClick="show('on'); hide('off'); playAudio(); document.getElementById('mymarquee').start();" alt="on">
<img id="on" src="images/general/sound-on.png" width="40" height="32" onClick="show('pause'); hide('on'); pauseAudio(); document.getElementById('mymarquee').stop();" style="display:none;" alt="off">
<img id="pause" src="images/general/sound-pause.png" width="40" height="32" onClick="show('on'); hide('pause'); playAudio(); document.getElementById('mymarquee').start();" style="display:none;" alt="on">
</div>
</div>
根据您的描述,以下是我能想到的
<marquee behavior="scroll" direction="left" id="mymarquee" >
<p>Go on... press the button!</p>
</marquee>
<input type="button" value="Stop Marquee" onClick="document.getElementById('mymarquee').stop();">
<input type="button" value="Start Marquee" onClick="document.getElementById('mymarquee').start();">
<script>
$(document).ready(function(){
$("#mymarquee")[0].stop();
});
</script>
继续。。。按下按钮
$(文档).ready(函数(){
$(“#mymarquee”)[0]。停止();
});
通过在body onload中添加mymarquee.stop()来解决字幕的自动启动问题。:-)
现在,我们有了一个多切换播放按钮,可以播放和暂停音频文件,同时在整个屏幕上滚动音频的歌曲文本(包括暂停)。工作起来很有魅力:-)那么确切的问题是什么。。这篇文章中没有一个问题。问题是没有建立与按钮的连接。悬停肯定不会在智能手机上工作(phonegap)因此,我需要找到一个解决方案来连接javascript文件,该文件将停止页面输入上的字幕,并连接到播放按钮,以便在用户按下音频按钮时开始滚动
<body onload="document.getElementById('mymarquee').stop();">