Menu
can i put in this line prefix
[CODE]document.getElementById(“youtube”).src = vids[num];
to be something like this ?
[CODE]document.getElementById(“http://www.youtube.com/embed/” + “youtube”).src = vids[num];
thank you in advance ?
[CODE]document.getElementById("http://www.youtube.com/embed/" + "youtube").src = vids[num];[/CODE]
[/QUOTE]
[CODE]
<script type="text/javascript">
function rand ( n )
{
return ( Math.floor ( Math.random ( ) * n + 1 ) );
}
var vids = new Array ( );
vids[0] = "http://www.youtube.com/embed/aF4M0JtoIPk"; ">>>>SONG NAME<<<<"
vids[1] = "http://www.youtube.com/embed/KMxWhovYfzc"; ">>>>SONG NAME<<<<"
function pick_vid ( )
{
var numberOfImages = 2;
var num = rand(numberOfImages)-1;
document.getElementById("random_youtube_vid").src = vids[num];
document.getElementById("LINK").innerHTML = vids[num];
}
</script>
<script type="text/javascript">window.onload=pick_vid;</script>
<iframe id="random_youtube_vid" width="250" height="200" frameborder="0" allowfullscreen></iframe>
<div id="LINK"></div>
[/CODE]
[CODE]<div id="LINK"></div> [/CODE]
instead of showing url from youtube video[CODE]...
var vids=[
["http://www.youtube.com/embed/aF4M0JtoIPk", ">>>>SONG NAME 1<<<<"],
["http://www.youtube.com/embed/KMxWhovYfzc", ">>>>SONG NAME 2<<<<"]
];
function pick_vid ( )
{
var numberOfImages = 2;
var num = rand(numberOfImages)-1;
document.getElementById("random_youtube_vid").src = vids[num][0];
document.getElementById("LINK").innerHTML = vids[num][1];
}
...[/CODE]
[CODE]
var vids=[
["aF4M0JtoIPk", ">>>>SONG NAME 1<<<<"],
["KMxWhovYfzc", ">>>>SONG NAME 2<<<<"]
];
[/CODE]
[CODE]...
var vids=[
["aF4M0JtoIPk", ">>>>SONG NAME 1<<<<"],
["KMxWhovYfzc", ">>>>SONG NAME 2<<<<"]
];
function pick_vid ( )
{
var numberOfImages = 2;
var num = rand(numberOfImages)-1;
[COLOR="red"]var prefix = "http://www.youtube.com/embed/";[/COLOR]
document.getElementById("random_youtube_vid").src = [COLOR="Red"]prefix+[/COLOR]vids[num][0];
document.getElementById("LINK").innerHTML = vids[num][1];
}
...[/CODE]
<i>
</i> var numberOfImages = 2;
var num = rand(numberOfImages)-1;
var prefix = "http://www.youtube.com/embed/"; <br/>
[COLOR="Red"]var suffix = "?rel=0&am;autoplay=1";[/COLOR]
document.getElementById("random_youtube_vid").src = prefix+vids[num][0][COLOR="Red"]+suffix[/COLOR];
document.getElementById("LINK").innerHTML = vids[num][1];
[CODE]<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>123</title>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<style type="text/css">
body{text-align:center;font-family:Verdana,Arial;font-size:11px;background-color:#fff;color:#000;padding:0px;margin:30px;}
a:link,a:active,a:visited{color:#000;background-color:transparent;font-weight:bold;letter-spacing:1px;text-decoration:none;}
a:hover{color:Crimson;background-color:transparent;font-weight:bold;letter-spacing:1px;text-decoration:none;}
div{margin-top:5px;padding:20px;}
b{color:Crimson;}
.cur{color:Green;background-color:transparent;}
.tot{color:Darkorange;background-color:transparent;}
</style>
<script type="text/javascript">
//we can use this synthax instead of var1=...;var2=...; etc.
var prefix="http://www.youtube.com/embed/",
suffix="?rel=0&am;autoplay=1",
vids=[
["aF4M0JtoIPk", "Reborn - Amina Khan"],
["KMxWhovYfzc", "New Muslims in Europe"],
["1eUOgD2Y9c8", "My Reversion To Islam"],
["hp0Wn8BoKyA", "Islam Saved My Life"]
];
function randomNumber(m,n){m=parseInt(m);n=parseInt(n);return Math.floor(Math.random()*(n-m+1))+m;}
function pick_vid(){
var num=(typeof(pick_vid.arguments[0])!='undefined')?pick_vid.arguments[0]:randomNumber(0,vids.length-1);
if(num==vids.length){num=0;}
/*the above means that you can pass the number of desirable song into the function
but if no any arguments passed the function picks a random song*/
$('#youtube_vid').attr('src',prefix+vids[num][0]+suffix);
$("#descr").html(vids[num][1]);
var ending='';
switch(num+1){
case 1:ending='st';break;
case 2:ending='nd';break;
case 3:ending='d';break;
default:ending='th';
}
$('#counter').html('<b class="cur">'+(num+1)+'-'+ending+'</b> of <b class="tot">'+vids.length+'</b> videos is being played now<br /><br /><a href="#null" onclick="pick_vid('+(num+1)+')">play next</a>');
}
$(document).ready(function(){
//just for fun
var h2=function(){$('h2:has(b:contains("JQuery"))').fadeOut('slow',function(){$(this).remove();});}
setTimeout(h2,1000);
});
</script>
</head>
<body>
<center>
<iframe id="youtube_vid" width="250" height="200" frameborder="0" allowfullscreen></iframe>
<div id="descr">song name goes here</div>
<div id="counter"><h2>Ok let's use <b>JQuery</b> as we went so far ;-)</h2></div>
<div><a href="#null" onclick="pick_vid()">random song</a></div>
</center>
</body>
</html>[/CODE]
[CODE]$(document).ready(function(){
//just for fun
var h2=function(){$('h2:has(b:contains("JQuery"))').fadeOut('slow',function(){$(this).remove();});}
setTimeout(h2,1000);
});[/CODE]
[CODE]$(document).ready(function(){
pick_vid();
});[/CODE]
[CODE]
<script type="text/javascript">
var prefix="http://www.youtube.com/embed/", suffix="?rel=0&am;autoplay=1"; //we can use this synthax instead of var1=...;var2=...; etc.
vids=[
["aF4M0JtoIPk", "Reborn - Amina Khan"],
["KMxWhovYfzc", "New Muslims in Europe"],
["1eUOgD2Y9c8", "My Reversion To Islam"],
["hp0Wn8BoKyA", "Islam Saved My Life"]
];
function randomNumber(m,n){
m=parseInt(m);n=parseInt(n);return Math.floor(Math.random()*(n-m+1))+m;
}
function pick_vid(){
var num=(typeof(pick_vid.arguments[0])!='undefined')?pick_vid.arguments[0]:randomNumber(0,vids.length-1);
if(num==vids.length){num=0;}
[COLOR="Red"]if (num==-1){num+=vids.length;}[/COLOR]
$('#youtube_vid').attr('src',prefix+vids[num][0]+suffix);
$("#descr").html(vids[num][1]);
var ending=' ';
switch(num+1){
case 1:ending='st';break;
case 2:ending='nd';break;
case 3:ending='d';break;
default:ending='th';
}
$('#counter').html('<b class="cur">'+(num+1)+'-'+ending+'</b> of <b class="tot">'+vids.length+'</b> videos is being played now<br /><a href="#null" onclick="pick_vid('+(num+1)+')">NEXT SONG</a>[COLOR="Red"]<a href="#null" onclick="pick_vid('+(num-1)+')">PREV SONG</a>[/COLOR]');
}
$(document).ready(function(){pick_vid();}); //autoplay random start
</script>
<iframe id="youtube_vid" width="250" height="200" frameborder="0" allowfullscreen></iframe>
<div id="descr">SONG TITLE</div><div id="counter"></div><div><a href="#null" onclick="pick_vid()">RANDOM SONG</a></div>
[/CODE]
[CODE]<a href="#randomize" onclick="pick_vid()"><img src="http://i43.servimg.com/u/f43/11/33/28/68/button10.png" title="Random Song"></a>[/CODE]
[CODE]var x=function(){$('a[href*=randomize]').fadeIn('fast');}
$('a[href*=randomize]').fadeOut('normal',function(){setTimeout(x,3000);});[/CODE]
[CODE]
vids=[
["vcZlR05X0m4", "Nile - Annihilation of the wicked"],
["eZra-mVOfc8", "Mortician - Hell on Earth"],
["j8DHnPP7zpg", "Infernal Revulsion - Trapped In Concrete, Seek Insanity"],
["IBsWHpbJAm0", "Abominable Putridity - Sphacelated Nerves"]
];
var prefix="http://www.youtube.com/embed/", suffix="?rel=0&am;autoplay=1"; //we can use this synthax instead of var1=...;var2=...; etc.
function randomNumber(m,n){m=parseInt(m);n=parseInt(n);return Math.floor(Math.random()*(n-m+1))+m;}
[COLOR="Red"]var x=function(){$('a[href*=randomize]').fadeIn('fast');}
$('a[href*=randomize]').fadeOut('normal',function(){setTimeout(x,3000);});[/COLOR]
function pick_vid(){
var num=(typeof(pick_vid.arguments[0])!='undefined')?pick_vid.arguments[0]:randomNumber(0,vids.length-1);
if(num==vids.length){num=0;}
if(num==-1){num+=vids.length;}
$('#youtube_vid').attr('src',prefix+vids[num][0]+suffix);
$("#descr").html(vids[num][1]);
var ending=' ';
$('#counter').html('<b class="cur">'+(num+1)+'</b> of <b class="tot">'+vids.length+'</b>');
$('#next').html('<a href="#null" onclick="pick_vid('+(num+1)+')">NEXT SONG</a>');
$('#prev').html('<a href="#null" onclick="pick_vid('+(num-1)+')">PREV SONG</a>');
}
$(document).ready(function(){pick_vid();}); //autoplay random start
[/CODE]
[CODE]
vids=[
["vcZlR05X0m4", "Nile - Annihilation of the wicked"],
["eZra-mVOfc8", "Mortician - Hell on Earth"],
["j8DHnPP7zpg", "Infernal Revulsion - Trapped In Concrete, Seek Insanity"],
["IBsWHpbJAm0", "Abominable Putridity - Sphacelated Nerves"]
];
var prefix="http://www.youtube.com/embed/", suffix="?rel=0&am;autoplay=1"; //we can use this synthax instead of var1=...;var2=...; etc.
function randomNumber(m,n){m=parseInt(m);n=parseInt(n);return Math.floor(Math.random()*(n-m+1))+m;}
function pick_vid(){
var num=(typeof(pick_vid.arguments[0])!='undefined')?pick_vid.arguments[0]:randomNumber(0,vids.length-1);
if(num==vids.length){num=0;}
if(num==-1){num+=vids.length;}
$('#youtube_vid').attr('src',prefix+vids[num][0]+suffix);
$("#descr").html(vids[num][1]);
var ending=' ';
$('#counter').html('<b class="cur">'+(num+1)+'</b> of <b class="tot">'+vids.length+'</b>');
$('#next').html('<a href="#null" onclick="pick_vid('+(num+1)+')">NEXT SONG</a>');
$('#prev').html('<a href="#null" onclick="pick_vid('+(num-1)+')">PREV SONG</a>');
[COLOR="Red"]var x=function(){$('a[href*=randomize]').fadeIn('fast');}
$('a[href*=randomize]').fadeOut('normal',function(){setTimeout(x,3000);});
[/COLOR]
}
$(document).ready(function(){pick_vid();}); //autoplay random start
[/CODE]
[CODE]<a href="#randomize" onclick="pick_vid()"><img src="http://i43.servimg.com/u/f43/11/33/28/68/button10.png" title="Random Song"></a>[/CODE]
[CODE]<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>123</title>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<style type="text/css">
body{text-align:center;font-family:Verdana,Arial;font-size:11px;background-color:#fff;color:#000;padding:0px;margin:30px;}
a:link,a:active,a:visited{color:#000;background-color:transparent;font-weight:bold;letter-spacing:1px;text-decoration:none;}
a:hover{color:Crimson;background-color:transparent;font-weight:bold;letter-spacing:1px;text-decoration:none;}
div{margin-top:5px;padding:20px;}
b{color:Crimson;}
.cur{color:Green;background-color:transparent;}
.tot{color:Darkorange;background-color:transparent;}
</style>
<script type="text/javascript">
var prefix="http://www.youtube.com/embed/",
suffix="?rel=0&am;autoplay=1",
vids=[
["aF4M0JtoIPk", "Reborn - Amina Khan"],
["KMxWhovYfzc", "New Muslims in Europe"],
["1eUOgD2Y9c8", "My Reversion To Islam"],
["hp0Wn8BoKyA", "Islam Saved My Life"]
];
function randomNumber(m,n){m=parseInt(m);n=parseInt(n);return Math.floor(Math.random()*(n-m+1))+m;}
function pick_vid(){
var num=(typeof(pick_vid.arguments[0])!='undefined')?pick_vid.arguments[0]:randomNumber(0,vids.length-1);
if(num==vids.length){num=0;}
$('#youtube_vid').attr('src',prefix+vids[num][0]+suffix);
$("#descr").html(vids[num][1]);
var ending='';
switch(num+1){
case 1:ending='st';break;
case 2:ending='nd';break;
case 3:ending='d';break;
default:ending='th';
}
$('#counter').html('<b class="cur">'+(num+1)+'-'+ending+'</b> of <b class="tot">'+vids.length+'</b> videos is being played now<br /><br /><a href="#null" onclick="pick_vid('+(num+1)+')">play next</a>');
var x=function(){$('a[href*=randomize]').fadeIn('fast');}
$('a[href*=randomize]').fadeOut('normal',function(){setTimeout(x,3000);});
}
$(document).ready(function(){pick_vid();});
</script>
</head>
<body>
<center>
<iframe id="youtube_vid" width="250" height="200" frameborder="0" allowfullscreen></iframe>
<div id="descr">song name goes here</div>
<div id="counter"></div>
<div><a href="#randomize" onclick="pick_vid()"><img src="http://i43.servimg.com/u/f43/11/33/28/68/button10.png" title="Random Song"></a></div>
</center>
</body>
</html>[/CODE]
[CODE]<script type="text/javascript" src="http://example.forum.fm/18534.js"></script>[/CODE]
<i>
</i>var x=function()
$('img[href*=randomize]').fadeIn('fast');
$('img[href*=randomize]').fadeOut('normal',function(){setTimeout(x,3000);});
$('a[href*=randomize]').hide();
$('a[href*=randomize]').delay(8000).fadeIn();
0.1.9 — BETA 5.2