js实现跑马灯效果
2013-05-07 19:38
417 查看
<script type="text/javascript" >
function show() {
var info = document.getElementById('Text1');
info.value = info.value.substr(1) + info.value[0];//substr(这个参数是起始位置)第二个参数可以不写,取到最后
}
setInterval(show, 500);
function show1() {
var info1 = document.getElementById('Text2');
info1.value = info1.value[info1.value.length-1] + info1.value.substr(0, info1.value.length-1);
}
setInterval(show1, 500);
</script>
<input id="Text1" type="text" value="欢迎来测试 " /> <input id="Button1" type="button" value="滚动" onclick="show()"/><br />
<input id="Text2" type="text" value=" 北京欢迎您" /> <input id="Button2" type="button" value="滚动" onclick="show1()" />
function show() {
var info = document.getElementById('Text1');
info.value = info.value.substr(1) + info.value[0];//substr(这个参数是起始位置)第二个参数可以不写,取到最后
}
setInterval(show, 500);
function show1() {
var info1 = document.getElementById('Text2');
info1.value = info1.value[info1.value.length-1] + info1.value.substr(0, info1.value.length-1);
}
setInterval(show1, 500);
</script>
<input id="Text1" type="text" value="欢迎来测试 " /> <input id="Button1" type="button" value="滚动" onclick="show()"/><br />
<input id="Text2" type="text" value=" 北京欢迎您" /> <input id="Button2" type="button" value="滚动" onclick="show1()" />
相关文章推荐