Уважаемые знатоки, изучаю javascript и вот встала такая задача:
есть флеш-проигрыватель mju, у него в свою очередь есть возможность через js переключать каналы:
var opera = Boolean(window["opera"]);
var ie = (navigator.appName.indexOf("Microsoft") != -1) && !opera;
function mju_play_track(num) {
if (num <= 0) return false;
var mc = ie ? window.mju : window.document.mju;
mc.SetVariable("play_track",num);
}
function mju_play_file(chars) {
if (!chars.length) return false;
var mc = ie ? window.mju : window.document.mju;
mc.SetVariable("play_file",chars);
}
function mju_do(cmd) {
if (!cmd.length) return false;
var mc = ie ? window.mju : window.document.mju;
mc.SetVariable("do_"+cmd," ");
}
В html вставляется непосредственно ссылка, при клике на которой происходит переключение песни в плеере:
<a href="/" onclick="mju_play_track(1);return false;">Проиграть 1-й поток</a>
И есть вот такой скрипт с кнопочками по клику на которую происходит переход:
<script language="JavaScript">
var n = 1
var nn = 2
var nnn = 3
var nnnn = 4 /*Add more variables if you want more buttons showing, or take
them off if you want less. Remember to change the rest of the script
accordingly if you do this, as well as the <INPUT> tags in the HTML.*/
var theMessages = new Array(7); {
theMessages[1] = "This could lead to your Page one."
theMessages[2] = "This could lead to your Page two."
theMessages[3] = "This could lead to your Page three."
theMessages[4] = "This could lead to your Page four."
theMessages[5] = "This could lead to your Page five."
theMessages[6] = "This could lead to your Page six."
theMessages[7] = "This could lead to your Page seven." /*You don't have to have this array unless you still want alert boxes appearing when the buttons are clicked.*/
}
var theValues = new Array(7); {
theValues[1] = "Page 1"
theValues[2] = "Page 2"
theValues[3] = "Page 3"
theValues[4] = "Page 4"
theValues[5] = "Page 5"
theValues[6] = "Page 6"
theValues[7] = "Page 7" } //add more values and/or change them for your liking.
function goup() {
if(n > 1){n = n-1
nn = nn-1
nnn = nnn-1
nnnn = nnnn-1
//If you've changed the amount of buttons showing, add your extra variables - 1 here.
update()}}
function godown() {
if(nnnn < 7) { //Change the 7 if you want more buttons
n++
nn++
nnn++
nnnn++
/*Add your extra variables, with a '++' right after them here, if you've
changed the amount of buttons showing.*/
update()}
else{}}
//You could do 'window.location.href="whatever.html"' insted of the current alert boxes.
function go1() {
alert(cap1)}
function go2() {
alert(cap2)}
function go3() {
alert(cap3)}
function go4() {
alert(cap4)}
function update() {
document.form1.b1.value = theValues[n]
document.form1.b2.value = theValues[nn]
document.form1.b3.value = theValues[nnn]
document.form1.b4.value = theValues[nnnn]
cap1 = theMessages[n]
cap2 = theMessages[nn]
cap3 = theMessages[nnn]
cap4 = theMessages[nnnn]}
//-->
</script>
</head>
<body onload="update()">
<center><h1>Scrollbar of Buttons</h1></center>
<form name="form1">
<input type=button name="up" value=" ^ " onclick="goup()"><br>
<input type=button name="b1" value="Link To Page One " onclick="go1()"><br>
<input type=button name="b2" value="Link To Page Two " onclick="go2()"><br>
<input type=button name="b3" value="Link To Page Three" onclick="go3()"><br>
<input type=button name="b4" value="Link To Page Four " onclick="go4()"><br>
<!-- If you add extra buttons here, insert them just above this comment.
You must add extra functions in the script too, presumably called go5()
etc.. -->
<input type=button name="down" value=" v " onclick="godown()">
</form>
Вопрос, как их скрестить чтобы при клике во втором скрипте происходило переключение песен в плеере? Бьюсь третий день, интересно увидеть как бы это реализовали люди с опытом.
Заранее спасибо.